我想运行 go get 命令时GOPROXY='direct'
,我尝试使用 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
但它也未能完成这项工作。