2020-12-25 17:36:16 +08:00
|
|
|
|
# Golang 安装 Packages
|
|
|
|
|
|
|
|
|
|
## 1.proxy.golang.org timeout 无法访问
|
|
|
|
|
|
|
|
|
|
go 默认使用的是 proxy.golang.org,在国内无法访问。
|
|
|
|
|
|
|
|
|
|
换一个国内能访问的代理地址:<https://goproxy.cn>,命令如下:
|
|
|
|
|
|
|
|
|
|
```bash
|
2021-01-29 17:11:56 +08:00
|
|
|
|
go env -w GO111MODULE=on
|
2020-12-25 17:36:16 +08:00
|
|
|
|
go env -w GOPROXY=https://goproxy.cn
|
|
|
|
|
```
|
2020-12-25 17:38:22 +08:00
|
|
|
|
|
|
|
|
|
## 2.安装 Packages
|
|
|
|
|
|
|
|
|
|
以安装 guru 为例:
|
|
|
|
|
|
|
|
|
|
```bash
|
2021-01-29 17:11:56 +08:00
|
|
|
|
go get golang.org/x/tools/cmd/guru
|
2020-12-25 17:38:22 +08:00
|
|
|
|
go build golang.org/x/tools/cmd/guru
|
|
|
|
|
mv guru $(go env GOROOT)/bin
|
|
|
|
|
```
|