go get timout 问题

 

 

使用goproxy

Go的1.11版本以后 可以设置GOPROXY这个变量,来设置代理。 

如果你自己有代理服务器就可以把这个环境变量设置成自己的代理。 

首先开启go module支持:

在Mac/linux下执行:

export GO111MODULE=on

Windows平台执行:

SET GO111MODULE=on

 

我们这里以https://goproxy.cn为例:

在Mac/linux下可以执行以下命令来设置:

 export GOPROXY=https://goproxy.cn

Windows平台在cmd执行以下命令来设置:

 SET GOPROXY="https://goproxy.cn"

或者在PowerShell中执行:

C:> $env:GOPROXY = "https://goproxy.cn"

posted @ 2023-03-13 00:15  纵码万水千山  阅读(25)  评论(0编辑  收藏  举报