go get错误(A connection attempt failed...)

发布于 2022-02-21  794 次阅读


内容纲要

错误如下:

go get: module github.com/gin-gonic/gin: Get "https://proxy.golang.org/github.com/gin-gonic/gin/@v/list": dial tcp 142.251.43.17:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

解决方法:
添加代理
WINDOWS:

# 设置goproxy.io代理
go env -w GOPROXY="https://goproxy.io"
# 设置GO111MOUDLE
go env -w GO111MODULE="on"

MAC:

# 设置goproxy.io代理
export GOPROXY=https://goproxy.io
# 设置GO111MOUDLE
export GO111MODULE=on 

不爱嘉然小姐十年了。十年里,爱过的每个人都像她。