(1)github资源拉取过慢:
解决:使用github代理
查找ipaddress: https://www.ipaddress.com/ip-lookup
输入:github.com 和 github.global.ssl.fastly.net
设置:C:\Windows\System32\drivers\etc\hosts文件映射
例如:
140.82.112.4 github.com
199.232.69.194 github.global.ssl.fastly.net
配置生效:
ipconfig /flushdns
配置go环境参数:
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
(2)go list -m: can’t compute ‘all’ using the vendor directory goland使用go mod模式的步骤详解不对
正确的步骤:
第一步:创建空文件夹
第二步:goland以项目方式打开文件夹
第三步:设置goland中的配置,goroot,gomodule
第四步:执行go mod init + 项目名,这个截图的地方多一个go modules,用于存放下载的包的
第五步:创建.go文件,然后写上代码
第六步:执行go mod tidy,下载所需的包,也会删除多余的包