gin框架中import gorm.io/driver/mysql, 使用go mod tidy 命令后时,报错
import gorm.io/driver/mysql, 使用go mod tidy ,报错:gorm.io/driver/mysql: gorm.io/driver/mysql@v1.4.6: verifying module: gorm.io/driver/mysql@v1.4.6: checking tree#15366953 against tree#15495139: reading h
·
在model中创建core.go时,需要使用gorm.io/driver/mysql,引入了gorm.io/driver/mysql,使用go mod tidy 更新,出现如下错误:
F:\www\go-data\src\go_code\gin\gindemo>go mod tidy
go: finding module for package gorm.io/driver/mysql
go: downloading gorm.io/driver/mysql v1.4.6
gindemo/models imports
gorm.io/driver/mysql: gorm.io/driver/mysql@v1.4.6: verifying module: gorm.io/driver/mysql@v1.4.6: checking tree#15366953 agai
nst tree#15495139: reading https://goproxy.io/sumdb/sum.golang.org/tile/8/1/234: 404 Not Found
server response: not found
nst tree#15495139: reading https://goproxy.io/sumdb/sum.golang.or
g/tile/8/1/234: 404 Not Found
server response: not found
该原因是国内被墙了,解决方案:
终端依次输入:
go env -w GOSUMDB=off
go env -w GOPROXY=https://goproxy.cn
重新go mod tidy即可:
F:\www\go-data\src\go_code\gin\gindemo>go env -w GOSUMDB=off
F:\www\go-data\src\go_code\gin\gindemo>go env -w GOPROXY=https://goproxy.cn
warning: go env -w GOPROXY=... does not override conflicting OS environment variable
F:\www\go-data\src\go_code\gin\gindemo>go mod tidy
go: finding module for package gorm.io/driver/mysql
go: downloading gorm.io/driver/mysql v1.4.6
go: found gorm.io/driver/mysql in gorm.io/driver/mysql v1.4.6
更多推荐
已为社区贡献3条内容
所有评论(0)