欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Error: shfmt: Failed to download resource "go--gobootstrap" Download failed: https://storage.googleapis.com/golang/go1.20.14.darwin-amd64.tar.gz 有大用 有大大用

Go:Mac 安装 Go


brew 安装

  • 网上很多教程,都是让直接 brew install go,但在实际安装过程中,却遇到诸多问题。

  • 问题一:DownloadError: Failed to download resource "go--gobootstrap"

Warning: You are using macOS 10.12.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.

==> Downloading https://dl.google.com/go/go1.13.5.src.tar.gz
Already downloaded: /Users/pandong/Library/Caches/Homebrew/downloads/702da802ab85b015c391ed1b3f565f1c11a0d563d3c9e17faabb4786665e6f8b--go1.13.5.src.tar.gz
==> Downloading https://storage.googleapis.com/golang/go1.7.darwin-amd64.tar.gz

curl: (7) Failed to connect to storage.googleapis.com port 443: Operation timed out
Error: An exception occurred within a child process:
DownloadError: Failed to download resource "go--gobootstrap"
Download failed: https://storage.googleapis.com/golang/go1.7.darwin-amd64.tar.gz

  • 问题二: Failed to connect to go.googlesource.com port 443: Operation timed out

Warning: You are using macOS 10.12.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.

==> Downloading https://dl.google.com/go/go1.13.5.src.tar.gz
Already downloaded: /Users/pandong/Library/Caches/Homebrew/downloads/702da802ab85b015c391ed1b3f565f1c11a0d563d3c9e17faabb4786665e6f8b--go1.13.5.src.tar.gz
==> Downloading https://storage.googleapis.com/golang/go1.7.darwin-amd64.tar.gz
Already downloaded: /Users/pandong/Library/Caches/Homebrew/downloads/ad0901a23a51bac69b65f20bbc8e3fe998bc87a3be91d0859ef27bd1fe537709--go1.7.darwin-amd64.tar.gz
==> ./make.bash --no-clean
==> /usr/local/Cellar/go/1.13.5/bin/go install -race std
==> Cloning https://go.googlesource.com/tools.git
Cloning into '/Users/pandong/Library/Caches/Homebrew/go--gotools--git'...
fatal: unable to access 'https://go.googlesource.com/tools.git/': Failed to connect to go.googlesource.com port 443: Operation timed out
Error: An exception occurred within a child process:
DownloadError: Failed to download resource "go--gotools"
Failure while executing; git clone --branch release-branch.go1.13 https://go.googlesource.com/tools.git /Users/pandong/Library/Caches/Homebrew/go--gotools--git exited with 128. Here's the output:
Cloning into '/Users/pandong/Library/Caches/Homebrew/go--gotools--git'...
fatal: unable to access 'https://go.googlesource.com/tools.git/': Failed to connect to go.googlesource.com port 443: Operation timed out

pkg 安装

  • 下载源码包:
    -- 下载地址:https://golang.org/dl/

  • 安装:
    -- 双击 .pkg 文件,直接安装。

  • 配置环境变量:

vim ~/.bash_profile

将下面的内容复制黏贴进文件中;

export GOPATH=/usr/local/go      # 日常开发的根目录
export GOBIN=$GOPATH/bin         # GOPATH下的bin目录
export PATH=$PATH:$GOBIN         # 环境变量路径
  • 启用配置文件,让环境变量在修改后立即生效;

source ~/.bash_profile
  • 验证

go version

得到如下输出,表示安装成功。

go version go1.14.1 darwin/amd6

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者



来自  https://www.jianshu.com/p/14e12c3171f6


普通分类: