go get timeout超时解决
- 发表于
- go
go get的时候超时timeout了:
1 2 3 |
➜ ukr (master) ✔ go get github.com/** package golang.org/x/net/html: unrecognized import path "golang.org/x/net/html" (https fetch: Get https://golang.org/x/net/html?go-get=1: dial tcp 172.217.163.49:443: i/o timeout) package golang.org/x/net/html/atom: unrecognized import path "golang.org/x/net/html/atom" (https fetch: Get https://golang.org/x/net/html/atom?go-get=1: dial tcp 172.217.163.49:443: i/o timeout) |
原因和github超时是一样的,换个代理就行:
Goproxy.cn 使用
Go 1.13 and above (RECOMMENDED)
Open your terminal and execute
1 2 |
$ go env -w GO111MODULE=on $ go env -w GOPROXY=https://goproxy.cn,direct |
done.
macOS or Linux
Open your terminal and execute
1 2 |
$ export GO111MODULE=on $ export GOPROXY=https://goproxy.cn |
or
1 2 3 |
$ echo "export GO111MODULE=on" >> ~/.profile $ echo "export GOPROXY=https://goproxy.cn" >> ~/.profile $ source ~/.profile |
done.
Windows
Open your terminal and execute
1 2 |
C:\> $env:GO111MODULE = "on" C:\> $env:GOPROXY = "https://goproxy.cn" |
or
1 2 3 4 5 6 7 8 9 10 11 12 |
1. Open the Start Search, type in "env" 2. Choose the "Edit the system environment variables" 3. Click the "Environment Variables…" button 4. Under the "User variables for <<strong>YOUR_USERNAME</strong>>" section (the upper half) 5. Click the "New..." button 6. Choose the "Variable name" input bar, type in "GO111MODULE" 7. Choose the "Variable value" input bar, type in "on" 8. Click the "OK" button 9. Click the "New..." button 10. Choose the "Variable name" input bar, type in "GOPROXY" 11. Choose the "Variable value" input bar, type in "https://goproxy.cn" 12. Click the "OK" button |
done.
原文连接:go get timeout超时解决
所有媒体,可在保留署名、
原文连接
的情况下转载,若非则不得使用我方内容。