Hunter的大杂烩 技术学习笔记

2022-08-07

编译go 程序遇到 invalid version 处理方法

Filed under: 技术话题 — hunter @ 5:42 pm

编译prometheus插件时,频繁出现以下错误:

github.com/mwitkow/go-conntrack@v0.0.0-20161129095857-cc309e4a2223: invalid version

github.com/golang/protobuf@v1.4.0-rc.4.0.20200313231945-b860323f09d0: invalid version:

主要是依赖的模块版本在github上已经被删除,可以使用replace方式,将相关版本替换,修改项目go.mod ,增加如下条目:

replace (
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0 => github.com/golang/protobuf v1.4.0
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 => github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc => google.golang.org/protobuf v1.24.0
)

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress