• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Go1.14版本vendor和gomodule冲突问题

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

Go1.14版本vendor和gomodule冲突问题

go1.14版本使用go mod tidy构建依赖时会出现问题(见链接), 这个问题在go1.12版本是不会出现的.

https://github.com/restic/rest-server/issues/102

这是由于1.14版本官方加入了校验机制导致的, 解答:

Hey, thanks for the hint! I'm guessing this is Go 1.14, right?

They added verification code that makes sure the vendored dependencies are in good order. You could either build without vendoring or run go mod vendor again, which will refresh everything. We will probably remove the vendored libraries, but until this is done we need to refresh them and commit the result.

Please be aware that when you do that, the Go tooling verifies that the correct code is placed into vendor/ by using the cryptographic hashes in go.sum. Pretty awesome ????

解决方法:

  1. 使用低版本的go, 但更推荐第二种方法.

  2. 删除自带vendor重建依赖

    项目文件夹下不能有vendor目录!!!, 除非是go mod vendor生成的

    # 保证在dtagentplus目录下
    # 1. 删除vendor文件夹
    mv vendor ${GOPATH}
    # 2. 重新replace本地依赖, 指向${GOPATH}/vendor
    vim go.mod
    # 3. 重建依赖
    go mod tidy
    # 4. 生成vendor, 可做可不做
    go mod vendor
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Go的并发调度原理 - RyuGou发布时间:2022-07-10
下一篇:
go-chart发送图文的统计报表邮件发布时间:2022-07-10
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap