您好,欢迎来到花图问答。
搜索
您的当前位置:首页下载 golang.org/x 包出错不用代理的解决办法

下载 golang.org/x 包出错不用代理的解决办法

来源:花图问答

由于国内的网络环境导致在下载依赖 golang.org/x 下的包时一般会出错。
比如 :

一般你可以通过设置代理,如果代理使用了 pac 模式的话,可能需要编辑下 pac 文件。下面要介绍的是一种不代理的解决办法。

原理

  1. 当我们使用 import "golang.org/x/tools/go/buildutil" 导入包时,其实导入的是$GOPATH/src/golang.org/x/tools/go/buildutil目录的包。

实例

比如先切换到 $GOPATH 的 src 目录,cd $GOPATH/src,然后按需要下载:

  1. git clone --depth 1 golang.org/x/tools
  2. git clone --depth 1 golang.org/x/lint
  3. git clone --depth 1 golang.org/x/net
  4. git clone --depth 1 golang.org/x/sys
  5. git clone --depth 1 golang.org/x/crypto
  6. git clone --depth 1 golang.org/x/text
  7. git clone --depth 1 golang.org/x/image
  8. git clone --depth 1 golang.org/x/oauth2

Copyright © 2019- huatuowenda.com 版权所有 湘ICP备2023022495号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务