cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multip

cannot load github.com/ugorji/go/codec: ambiguous import: found github.com/ugorji/go/codec in multiple modules

执行go build时出现此提示

build mps/guid-service/guid-api: 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 (F:\Go Project\pkg\mod\github.com\ugorji\[email protected]\codec)
        github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 (F:\Go Project\pkg\mod\github.com\ugorji\go\[email protected])

 网上说的那个replace的方法在我这里无效

// replace github.com/ugorji/go v1.1.4 => github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8


 解决办法:自己碰到的问题,解决有效

1.设置好下载代理,防止包下载有问题

![在这里插入图片描述](https://img-blog.csdnimg.cn/20191029103928907.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3hpYW9saWFuZ3phaTEy,size_16,color_FFFFFF,t_70)

![在这里插入图片描述](https://img-blog.csdnimg.cn/20191029104009158.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3hpYW9saWFuZ3phaTEy,size_16,color_FFFFFF,t_70)

确保代理生效后,执行下面命令

go get github.com/ugorji/[email protected]

下载ok后再go build,问题解决

PS D:\MPS-backend\mps\guid-service\guid-api> go get github.com/ugorji/[email protected]
go: finding github.com/ugorji/go v1.1.2
go: downloading github.com/ugorji/go v1.1.2
go: extracting github.com/ugorji/go v1.1.2
PS D:\MPS-backend\mps\guid-service\guid-api> go build
go: downloading github.com/gin-gonic/gin v1.3.0
go: extracting github.com/gin-gonic/gin v1.3.0
go: finding github.com/gin-gonic/gin v1.3.0
PS D:\MPS-backend\mps\guid-service\guid-api> go build
PS D:\MPS-backend\mps\guid-service\guid-api>


你可能感兴趣的:(问题解决)