Go 语言安装后,需要设置的地方

发布时间 2023-08-21 02:18:46作者: 王者心·青铜梦
  1. 下载  All releases - The Go Programming Language (google.cn)
    1. 我用的是解压版
  2. 设置环境变量  
  3. 打开终端, 输入 go env
  4. 环境变量GOPROXY和GO111MODULE设置

    1.   
       1 # window
       2 $ go env -w GO111MODULE=on
       3 $ go env -w GOPROXY=https://goproxy.cn,direct
       4 
       5 # macOS 或 Linux
       6 $ export GO111MODULE=on
       7 $ export GOPROXY=https://goproxy.cn
       8 
       9 # macOS 或 Linux
      10 $ echo "export GO111MODULE=on" >> ~/.profile
      11 $ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
      12 $ source ~/.profile