permanent
2a4 Golangmodified | Sunday 29 June 2025 |
---|
date created: 9 June 2022
date modified: 14 March 2023
title: Golang
首次安装完以后,由于地址被屏蔽,且 go 命令不走 v2ray 代理,所以需要更换 GOPROXY
go env -w GOPROXY="https://goproxy.cn"
接着需要把 GOPATH 加入到 bash 或 zsh 的执行环境中,使得 go get 的二进制命令可以直接被 shell 识别。
1# Add the following 2 lines to your ~/.bash_profile
2export GOPATH=/Users/$USER/go
3export PATH=$GOPATH/bin:$PATH
4
5# In your current terminal, to reload the session
6source ~/.bash_profile