解决难缠的couldn't load packages due to errors: gopkg.in/go-playground/validator.v9

在基于gin使用swagger生成sdk,即执行swagger命令时老是报不能找到包的错误,费尽周折,终于找到了解决办法。

报错如下:

E:\JOB\go113\GOWork\pkg\mod\gopkg.in\go-playground\[email protected]\baked_in.go:18:6: could not import github.com/leodido/go-urn (cannot find package "github.com/leodido/go-urn" in any of:
	E:\JOB\go113\GO\src\github.com\leodido\go-urn (from $GOROOT)
	E:\JOB\go113\GOWork\src\github.com\leodido\go-urn (from $GOPATH))
couldn't load packages due to errors: gopkg.in/go-playground/validator.v9
main.go:2: running "swagger": exit status 1

尝试了手动git clone指定版本都没有解决...

最后,偶然的一次修改,把mod文件中的

github.com/gin-gonic/gin v1.3.0

修改成了  github.com/gin-gonic/gin v1.4.0就OK了!

即改了下版本就行了。把这次方案记下来,希望帮到更多的人!

 

天若有情天亦老,月若无恨月常圆

你可能感兴趣的:(#,go,研发工具&环境,go,mod)