您的位置 首页 golang

go mod undefined: balancer.PickOptions 错误解决

现在高版本的golang(比如1.14)使用go mod进行包管理,虽然比之前的方式规范了一些,但是对于刚接触的人来说,确实有很多坑需要踩.之前用golang1.11用的挺好的,本地库也都是老版本的包,突然升级一些包,然后这些包里面用到了go mod,一下子发现很多包压根找不到了,因为go mod是语义化的版本,有的根本不存在.
undefined: balancer.PickOptions
这个问题的根本就是包冲突了,使用go get命令会自动获取最新的包.
在go.mod文件最后增加下面的replace就可以了.

replace google.golang.org/grpc => google.golang.org/grpc v1.26.0

还有个需要注意的就是,最好不要用go get -u 这个命令去拉取所有包,很多包都没用到,反而带来了一堆包依赖的错误.尽量需要什么包,就go get什么包.这样能避免很多坑.go mod毕竟刚开始,发展还需要一个漫长的过程.很多历史问题需要解决.


文章来源:智云一二三科技

文章标题:go mod undefined: balancer.PickOptions 错误解决

文章地址:https://www.zhihuclub.com/180.shtml

关于作者: 智云科技

热门文章

评论已关闭

5条评论

  1. 土豪在签名炫耀说,钱太多了,花不完。 毒舌回复:托梦给你子孙叫他们少烧点。很喜欢您的文章by

  2. Clomid Et Ovulation – Cialis Cialis Comparatif Prix Ivrtkc Cialis Ou Autres – viagra cialis online

  3. Drug export from cells is a primary cause of the cellular resistance to anticancer drugs and poses a significant threat to clinical tumor therapy 5 Vachon et al 20 concluded that the detection of changes in density among postmenopausal women may be difficult because of the lower baseline density

  4. Sources of vitamin D include cutaneous synthesis upon exposure to sunlight, dietary intake, and supplements 5C cells were treated with 10 9 M E 2 and 10 ОјM of each CASP inhibitor as indicated for 96 h

网站地图