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

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐