Skip to content

Commit 8c96a19

Browse files
committed
环境变量
1 parent 5670750 commit 8c96a19

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Go 基本环境配置.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# GOROOT
2+
3+
GOROOT 是 Go 程序安装位置,等同于 JAVA_HOME。
4+
5+
# GOPATH
6+
7+
GOPATH 是程序或依赖包安装目录,等同于 Maven 的 repository。
8+
9+
# GOPROXY
10+
11+
GOPROXY 用于设置 Go 依赖包镜像地址,加快依赖下载。推荐 [https://proxy.golang.com.cn/](https://proxy.golang.com.cn/)
12+
13+
一键配置:
14+
15+
Bash (Linux or macOS):
16+
17+
```bash
18+
# 配置 GOPROXY 环境变量
19+
export GOPROXY=https://proxy.golang.com.cn,direct
20+
# 还可以设置不走 proxy 的私有仓库或组,多个用逗号相隔(可选)
21+
export GOPRIVATE=git.mycompany.com,github.com/my/private
22+
```
23+
24+
PowerShell (Windows):
25+
26+
```PowerShell
27+
# 配置 GOPROXY 环境变量
28+
$env:GOPROXY = "https://proxy.golang.com.cn,direct"
29+
# 还可以设置不走 proxy 的私有仓库或组,多个用逗号相隔(可选)
30+
$env:GOPRIVATE = "git.mycompany.com,github.com/my/private"
31+
```

0 commit comments

Comments
 (0)