安装和配置 go

发布时间 2024-01-04 15:36:44作者: 春秋谷梁
# 安装和配置 go

## brew

```bash
$ brew install go
```

其他方式,可参考官网:https://go.dev/dl/

## 配置代理

环境变量
```bash
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=htttps://goproxy.cn" >> ~/.profile
source ~/.profile
```

go env
```bash
$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct
```

notice: 两种方式都可以配置,其中环境变量的优先级更高