编译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
)