在CentOS上进行Golang版本控制,可通过以下方式实现:
sudo yum install git
cd /path/to/project
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/yourname/repo.git
git push -u origin main
git branch feature-xxxgit checkout feature-xxxgit merge feature-xxxbash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source ~/.gvm/scripts/gvm
gvm install go1.20.3  # 安装指定版本
gvm use go1.20.3      # 切换版本
gvm global go1.20.3   # 设置全局版本
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.1
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
source ~/.bashrc
asdf plugin-add golang
asdf install golang 1.20.3
asdf global golang 1.20.3
export GO111MODULE=on
go mod init github.com/yourname/repo
go get github.com/pkg/errors@v1.2.3go get -ugo mod tidy/bin/、/vendor/等目录。v1.0.0)。