简体   繁体   English

安装 GO 时如何使用自定义的 go mod?

[英]How to use a customize go mod while installing GO?

I need to use go 1.17.9.我需要使用 go 1.17.9。

mod file 模组文件

However I need to use a different ( lower ) version of "golang.org/x/net" package, not the one specified in mod file.但是,我需要使用不同(较低)版本的“golang.org/x/net”包,而不是 mod 文件中指定的包。

EDIT - I do not need it in my modules directly.编辑 - 我的模块中不需要它。 My code is calling net, which calls x/net vendored into std library and relies on the older version of x/net to work.我的代码调用 net,它调用 x/net 供应到 std 库并依赖旧版本的 x/net 工作。 Specifically here is the change that broke.具体来说,这里是打破的变化。 My code used to passes a "wss" request and the code would return "non-nil" now with this change it returns "nil" sine it only identifies "http" and "https" scheme.我的代码用于传递“wss”请求,现在代码将返回“non-nil”,此更改返回“nil”,因为它仅标识“http”和“https”方案。 https://cs.opensource.google/go/x/net/+/7b1cca2348c07eb09fef635269c8e01611260f9f https://cs.opensource.google/go/x/net/+/7b1cca2348c07eb09fef635269c8e01611260f9f

我想你只是改变你想要的,如果你想添加你只需使用go mod vendor (用于添加新供应商)和go mod tidy (用于更新你的包)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM