文章

问题总结

1. go get: module golang.org/x/tour/gotour: Get “{url}”: dial tcp 142.251.42.241:443: i/o timeout

修改代理地址:

1
go env -w GOPROXY=https://goproxy.cn

2. go get: module golang.org/x/tour@upgrade found (v0.1.0), but does not contain package golang.org/x/tour/gotour 或者 go get: installing executables with ‘go get‘ in module mode is deprecated.

一般是因为版本号不对的问题导致

注: Go1.17版使用go install安装依赖, 后面加 "@latest(版本号)"

1
2
3
4
5
# Go1.16及以前
go get -u -v github.com/github/hub

# Go1.17版本
go install github.com/bingoohuang/hub@latest

3. package https:/www.github.com/bradfitz/goimports@latest: cannot use path@version syntax in GOPATH mode(暂未解决)

1
export GO111MODULE=on

4. Get “https://proxy.golang.org/github.com/ i/o timeout

在可以打开github.com前提下,配置直接访问github

1
go env -w GOPROXY=direct

5. LibreSSL SSL_read: error:02FFF03C:system library:func(4095):Operation timed out, errno 60

看3、4

6. go: cannot run *_test.go files (hello_test.go)

*_test.go是golang特有的约定,为测试文件, 需要改名

7. main redeclared in this block

1
2
3
同一个文件夹下出现多个main函数定义

测试的时候换目录
本文由作者按照 CC BY 4.0 进行授权