我想在GOPROXY='direct'时运行go get命令,我尝试使用VS代码终端运行这个命令:
GOPROXY='direct' go get go.mongodb.org/mongo-driver/mongo但我发现了一个错误:
GOPROXY=direct : The term 'GOPROXY=direct' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ GOPROXY='direct' go get go.mongodb.org/mongo-driver/mongo
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (GOPROXY=direct:String) [], CommandNotFoundEx
ception
+ FullyQualifiedErrorId : CommandNotFoundException我也试过:
go env set GOPROXY='direct'但是,当我运行go env命令时,GOPROXY值仍然与这个GOPROXY=https://proxy.golang.org,direct类似,我还试图在windows环境变量中定义一个GOPROXY变量,并给它direct的值,但它也做不到这一点。
发布于 2021-12-15 08:27:17
确保您的VSCode终端是bash终端,而不是CMD或Powershell。
在CMD或Powershell中,语法var=xxx cmd不能正确解释为:设置变量并执行继承其环境变量(包括一个集合)的命令。
https://stackoverflow.com/questions/70347135
复制相似问题