出错信息:无法连接https://golang.org
go get github.com/zserge/lorca
unrecognized import path "golang.org/x/net/websocket": https fetch: Get "https://golang.org/x/net/websocket?go-get=1": dial tcp 216.239.37.1: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.
解决方案:
-
方法1:在GOPATH目录下建立对应包名,然后通过git下载工具包
mkdir -p %GOPATH%\src\golang.org\x
cd %GOPATH%\src\golang.org\x
git clone https://github.com/golang/net.git
C:\GOPATH\src\golang.org\x>git clone https://github.com/golang/net.git
Cloning into 'net'...
remote: Enumerating objects: 53, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 9286 (delta 18), reused 22 (delta 6), pack-reused 9233 eceiving objects: 99% (9273/9286), 7.90 MiB | 40.0Receiving objects: 100% (9286/9286), 7.93 MiB | 40.00 KiB/s
51.00 KiB/s, done.
Resolving deltas: 100% (6423/6423), done.
方法2:设置Module国内代理仓库
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
或
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy,direct