JiaHe

相遇即是缘

Go安装

编译安装

go_version=1.23.2
go_install_dir=/usr/local/
go_download_name=go$go_version.linux-amd64.tar.gz

# 国内环境可以替换为 https://studygolang.com/dl/golang/$go_download_name
wget https://golang.google.cn/dl/$go_download_name -P /tmp
tar zxf /tmp/$go_download_name -C $go_install_dir

cat > ~/.bash_profile <EOF
export PATH=$PATH:/usr/local/go/bin
EOF

source ~/.bash_profile

gvm安装

# 推荐在安装之前先清除 `GOROOT`、`GOBIN`
curl -sSL https://raw.githubusercontent.com/voidint/g/master/install.sh | bash
cat << 'EOF' >> ~/.bashrc

# Check if the alias 'g' exists before trying to unalias it
if [[ -n $(alias g 2>/dev/null) ]]; then
unalias g
fi
EOF

source "$HOME/.g/env"