go mod的坑

使用go-mod 引入某个包出错例子为

go: github.com/beego/bee imports
        github.com/beego/bee/cmd imports
        github.com/beego/bee/cmd/commands/dlv imports
        github.com/derekparker/delve/service: github.com/derekparker/delve@v1.3.2: parsing go.mod:
        module declares its path as: github.com/go-delve/delve
                but was required as: github.com/derekparker/delve

module declares its path as: github.com/go-delve/delve
but was required as: github.com/derekparker/delve

这句话的意思是

模块将其路径声明为:
但被要求:

module declares its path as:
but was required as:
解决办法

在你当前的项目下的

go.mod

文件中
加入

replace github.com/go-delve/delve => github.com/derekparker/delve v1.3.2 // indirect

格式为:

replace module declares its path as:(后边那部分) => but was required as:(后边那部分)

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐