关于golang.org.x包问题

方法一

  1. 进入GOPATH目录
win> cd %GOPATH%
linux> cd $GOPATH
  1. 创建\src\golang.org\x 目录并进入
win> mkdir %GOPATH%\src\golang.org\x
win> cd %GOPATH%\src\golang.org\x

linux> mkdir $GOPATH\src\golang.org\x
linux> cd $GOPATH\src\golang.org\x
  1. 从github.com上下载
git clone https://github.com/golang/net.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/time.git
git clone https://github.com/golang/crypto.git

go install golang.org/x/net/...
go install golang.org/x/sys/...
go install golang.org/x/tools/...
go install golang.org/x/time/...
go install golang.org/x/crypto/...
  1. go的官方包:
    https://golang.org/x => https://github.com/golang

方法二

  1. 从ssr中获取本地代理端口
127.0.0.1:1080
  1. curl测试
curl -x http://127.0.0.1:1080 www.google.com
  1. 设置http代理
  • windows下: 注意大小写
set http_proxy=代理ip:port (临时有效)
set HTTPS_PROXY=代理ip:port (临时有效)
set ALL_PROXY=代理ip:port(临时有效)

如:
set http_proxy=http://127.0.0.1:1080
set HTTPS_PROXY=http://127.0.0.1:1080
  • linux下: 注意大小写
export http_proxy=代理ip:port (临时有效)
export HTTPS_PROXY=代理ip:port (临时有效)
或者合成一条
export ALL_PROXY=代理ip:port (临时有效)

如:
export http_proxy=http://127.0.0.1:1080
export HTTPS_PROXY=http://127.0.0.1:1080
  1. 直接go get 安装
go get -u -v golang.org/x/net/...
go get -u -v golang.org/x/sys/...
go get -u -v golang.org/x/tools/...
go get -u -v golang.org/x/time/...
go get -u -v golang.org/x/crypto/...
0%