报错信息
go get: module github.com/go-sql-driver/mysql: Get "https://proxy.golang.org/github.com/go-sql-driver/mysql/@v/list": dial tcp 142.251.42.241:443: connect
ex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because conn
ected host has failed to respond.
错误原因
未设置代理,说实话我觉得你只要能正常访问github,应该就不会出错,如果不能正常访问,请你买个代理或者修改你的host文件,把github.com的域名映射ip写死。
回到本题,总是有大牛无私奉献,所以提供了直接可以配置的代理,这些代理专门用于导包。
操作
输入下面命令可以解决
go env -w GOPROXY=https://goproxy.cn,direct
我主要说说怎么在初始化一个项目的时候直接配置好,我使用的goland编辑器
好了,建议配置,尤其是你导入别人的开源项目的时候,直接go mod tidy省事。