ZhangZhihui's Blog  
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

 

posted on 2023-07-31 18:37  ZhangZhihuiAAA  阅读(7)  评论(0编辑  收藏  举报