一、问题描述
使用go get
安装时,如果地址是golang.org/x/...
,因为某原因所以无法下载。
1
2
3
go: golang.org/x/sys@v0.0.0-20181011152604-fa43e7bc11ba: unrecognized import path "golang.org/x/sys" (https fetch: Get https://golang.org/x/sys?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/net@v0.0.0-20181011144130-49bb7cea24b1: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: golang.org/x/net@v0.0.0-20180218175443-cbe0f9307d01: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
二、解决办法
设置go第三库下载代理即可。
1
2
liuxu:~$ go env -w GO111MODULE=on
liuxu:~$ go env -w GOPROXY=https://goproxy.cn,direct