1. go build, 提示以下错误:
github.com/alecthomas/[email protected]: Get "https://proxy.golang.org/github.com/alecthomas/template/@v/v0.0.0-20190718012654-fb15b899a751.mod": dial tcp 216.58.200.49: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.
2. 原以为是这个模块找不到,所以 在go mod 文件里,删除了报错的这一行,再次 go build, 还是同样的错误,只是模块名称不一样,这才意识到是代理地址的问题,不是模块找不到的问题
3. go env
发现是 set GOPROXY=https://proxy.golang.org,direct, 换成淘宝的地址,
set GOPROXY=https://mirrors.aliyun.com/goproxy/
再次 go build就不报错了。