gin-blog go run main.go
build command-line-arguments: cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules:
github.com/ugorji/go v1.1.4 (/Users/fangqi/go/pkg/mod/github.com/ugorji/go@v1.1.4/codec)
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 (/Users/fangqi/go/pkg/mod/github.com/ugorji/go/codec@v0.0.0-20181209151446-772ced7fd4c2)
➜ gin-blog rm -rf main
解决方法:
修改go.mod文件添加一行,如果使用goland他会提示你问题,保持就好了。
replace github.com/ugorji/go v1.1.4 => github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43
完整的go.mod文件
module gin-blog
go 1.12
require (
github.com/Unknwon/com v0.0.0-20190321035513-0fed4efef755
github.com/astaxie/beego v1.11.1
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 // indirect
github.com/gin-gonic/gin v1.4.0
github.com/go-ini/ini v1.42.0
github.com/jinzhu/gorm v1.9.8
github.com/swaggo/gin-swagger v1.1.0
)
replace github.com/ugorji/go v1.1.4 => github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43
网友评论