go

go-mod

go1.13.4 go get报错-mod

Posted by Liangjf on December 31, 2019

go1.13.4 go get报错-mod

执行go get

go: flag needs an argument: -mod (from $GOFLAGS)
usage: go get [-d] [-t] [-u] [-v] [-insecure] [build flags] [packages]Run 'go help get' for details.

go env查看环境设置

GOEXE=""
GOFLAGS=" -mod"         //这里有问题
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
...

对于go1.13.4,Goland自动设置变量GOFLAGS为-mod,去掉就ok了