国内下载 golang.org/x/* 包

  • 原创
  • Madman
  • /
  • /
  • 0
  • 1106 次阅读

Synopsis: 国内无法正常下载 golang.org/x/ 下的第三方依赖包,除了设置代理以外,还可以从 https://github.com/golang 下载镜像包

1. 问题

C:\Users\wangy>go get -u -v golang.org/x/text
package golang.org/x/text: unrecognized import path "golang.org/x/text" (https fetch: Get https://golang.org/x/text?go-get=1: dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)

2. 解决办法

2019年9月5日更新: 请升级 Go 到 1.13 版本,默认会启用 Go Modules 包管理器,此时,再通过设置 GOPROXY 为国内能够访问的代理服务器。最后,切换到某个存在 go.mod 文件(由 go mod init 命令生成)的目录下,执行 go get 命令即可!

https://github.com/golang 有相应的镜像包,所以只需要用 git 工具下载到你的 $GOPATH/src/golang.org/x/ 目录下即可

1. 创建目录
C:\Users\wangy>cd %GOPATH%/src/

C:\Users\wangy\go\src>mkdir golang.org\x

C:\Users\wangy\go\src>cd golang.org\x

C:\Users\wangy\go\src\golang.org\x>

2. 克隆
git clone https://github.com/golang/blog.git
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/exp.git
git clone https://github.com/golang/image.git
git clone https://github.com/golang/mobile.git
git clone https://github.com/golang/net.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/talks.git
git clone https://github.com/golang/text.git
git clone https://github.com/golang/tools.git

说明

  • golang.org/x/blog — the content and server program for blog.golang.org.
  • golang.org/x/crypto — additional cryptography packages.
  • golang.org/x/exp — experimental code (handle with care).
  • golang.org/x/image — additional imaging packages.
  • golang.org/x/mobile — libraries and build tools for Go on Android.
  • golang.org/x/net — additional networking packages.
  • golang.org/x/sys — for low-level interactions with the operating system.
  • golang.org/x/talks — the content and server program for talks.golang.org.
  • golang.org/x/text — packages for working with text.
  • golang.org/x/tools — godoc, vet, cover, and other tools.
分类: Go
标签: golang.org/x
未经允许不得转载: LIFE & SHARE - 王颜公子 » 国内下载 golang.org/x/* 包

分享

作者

作者头像

Madman

如需 Linux / Python 相关问题付费解答,请按如下方式联系我

0 条评论

暂时还没有评论.