Reputation: 81
I am facing this build error in Golang V1.17 intermittently.
# gorm.io/driver/mysql
../../../../pkg/mod/gorm.io/driver/[email protected]/migrator.go:224:24: cannot use column (type Column) as type gorm.ColumnType in append:
Column does not implement gorm.ColumnType (missing AutoIncrement method)
I have tried restarting, clearing cache on VS Code, deleting go.mod and go.sum, and what-not.
Is there a workaround or something?
Upvotes: 8
Views: 4683
Reputation: 51
I solve it by update all relative package,it works:
go get gorm.io/gorm
go get gorm.io/driver/mysql
go get gorm.io/driver/sqlserver
go get gorm.io/driver/postgres
go mod vendor
Upvotes: 5
Reputation: 721
my problem solved by installing mysql driver for gorm:
~ go get gorm.io/driver/mysql
Upvotes: 9
Reputation: 1326994
This is followed by go-gorm/gorm
issue 5096 which includes:
I update the latest gorm module with the following command:
rm -rf go.mod go.sum go mod init "panel" # <== replace by your own project name go mod tidy go mod vendor
After running the error, the replacement version is fine.
go mod edit -require=gorm.io/driver/[email protected] go mod edit -require=gorm.io/[email protected] go mod vendor
Upvotes: 3