For AI agents: the complete documentation index is available at https://www.tteam.icu/llms.txt, the full documentation bundle is available at https://www.tteam.icu/llms-full.txt, and this page is available as Markdown at https://www.tteam.icu/ops/linux/%E5%AE%89%E8%A3%85golang.md.

安装golang

export GOLANG_VERSION=$(curl -s https://go.dev/VERSION?m=text | awk -F'go' 'NR==1 {print $2}')
wget https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" > /etc/profile.d/golang.sh
source /etc/profile.d/golang.sh

go version

# 配置国内代理源
go env -w GO111MODULE=on
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct