go module 下载外网资源失败解决办法

执行打包脚本,发现报了一堆报错:

go: golang.org/x/[email protected]: 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: connect: connection timed out)

解决办法:

export http_proxy=10.244.255.3:7766
export https_proxy=10.244.255.3:7766

或者在~/.zshrc末尾添加:

export GO111MODULE="on"
export http_proxy=10.244.255.3:7766
export https_proxy=10.244.255.3:7766

你可能感兴趣的:(go module 下载外网资源失败解决办法)