mac 安装和升级go
go1.9.7 升级到 go1.15.6
之前由于电脑上面安装的go版本太低,导致部分程序调试失败,特此升级go版本记录升级过程
因为使用的brew安装的go,这里升级go版本,因此需要先执行
brew update
此时很不幸的是报错了
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
可能是国内环境问题导致,解决办法
cd /usr/local/Homebrew/Library/Taps/
mkdir homebrew
cd homebrew
git clone https://mirrors.ustc.edu.cn/homebrew-core.git
如果文件已经存在,会报错
此时执行删除文件操作
rm -rf homebrew-core
然后再次执行git clone
git clone https://mirrors.ustc.edu.cn/homebrew-core.git
由于之前已经安装的go1.9.7
需要先执行卸载操作
brew uninstall go@1.9
卸载完成后执行安装
brew install go
升级完毕
第一次安装 执行下面代码即可
brew install go