【发布时间】:2022-01-17 15:53:16
【问题描述】:
我想在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 的值,但它也未能完成这项工作。
【问题讨论】:
-
你会发送“go env”命令的输出吗?
标签: windows go visual-studio-code environment-variables goproxy