go get -u github.com/gin-gonic/gin 超时的原因有很多种 一般情况下为没有设置DL

  • 设置DL方式 windows下
1. 右键 我的电脑 -> 属性 -> 高级系统设置 -> 环境变量
2. 在 “[你的用户名]的用户变量” 中点击 ”新建“ 按钮
3. 在 “变量名” 输入框并新增 “GOPROXY”
4. 在对应的 “变量值” 输入框中新增 “https://proxy.golang.com.cn,direct”
5. 最后点击 “确定” 按钮保存设置
  • liunx下
# 设置你的 bash 环境变量
echo "export GOPROXY=https://proxy.golang.com.cn,direct" >> ~/.profile && source ~/.profile

# 如果你的终端是 zsh,使用以下命令
echo "export GOPROXY=https://proxy.golang.com.cn,direct" >> ~/.zshrc && source ~/.zshrc

如果使用goland ide下面的命令行有时候会有坑 。 我就踩过 总是请求超时 但是如果用系统自带的powershell就不会出现问题