zzh@ZZHPC:~/go$ go env GOPATH GOROOT GOENV GOPROXY /home/zzh/go /usr/local/go /home/zzh/.config/go/env https://goproxy.io,direct zzh@ZZHPC:~/go$ go env -json GOPATH GOROOT GOENV GOPROXY { "GOENV": "/home/zzh/.config/go/env", "GOPATH": "/home/zzh/go", "GOPROXY": "https://goproxy.io,direct", "GOROOT": "/usr/local/go" }
You can use the go env
command to portably set the default value for an environment variable for future go
commands:
$ go env -w GOBIN=/somewhere/else/bin
zzh@ZZHPC:~$ go env -w GOPROXY=https://goproxy.io,direct
To unset a variable previously set by go env -w
, use go env -u
:
$ go env -u GOBIN