syncd构建错误解决ambiguous import

问题

mvpbang@mvpbang syncd-master % go build -o out/syncd ./syncd/main.go
go: downloading github.com/Unknwon/goconfig v0.0.0-20181105214110-56bd8ab18619
../../go/pkg/mod/github.com/gin-gonic/gin@v1.4.0/binding/msgpack.go:12:2: ambiguous import: found package github.com/ugorji/go/codec in multiple modules:
github.com/ugorji/go v1.1.4 (/Users/mvpbang/go/pkg/mod/github.com/ugorji/go@v1.1.4/codec)
github.com/ugorji/go/codec v0.0.0-20190204201341-e444a5086c43 (/Users/mvpbang/go/pkg/mod/github.com/ugorji/go/codec@v0.0.0-20190204201341-e444a5086c43)

分析

ambiguous import: found package github.com/ugorji/go/codec in multiple modules:
同一个模块多次导入导致的,在go.mod 移除即可

01、go.mod移除重复的模块 ugorji
image

02、go mod tidy

03、go build -o out/syncd ./syncd/main.go

posted @ 2024-02-19 14:57  mvpbang  阅读(175)  评论(0编辑  收藏  举报