91

unrecognized import path "golang.org/x/sync

 5 years ago
source link: https://studygolang.com/articles/16323?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

go get时遇到超时错误

go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/sync" (https fetch: Get https://golang.org/x/sync?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

go: golang.org/x/[email protected]: unrecognized import path "golang.org/x/net" (https fetch: Get https://golang.org/x/net?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

go环境变量

export GOROOT=/usr/local/go

export GOPATH=/root/go

export PATH=$PATH:$GOROOT/bin

GOROOT为安装目录   GOPATH为工作目录

golang 在 github 上建立了一个镜像库,下载github上的镜像库放入GOPATH下即可

mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/net.git
git clone https://github.com/golang/sync.git

项目放在$GOPATH/src

执行go get即可成功


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK