由于國(guó)內(nèi)網(wǎng)絡(luò)原因,因此訪問https://golang.org/網(wǎng)站會(huì)被限制剪芍。所以在go get下載其他第三方包的時(shí)候,如果這個(gè)第三方包又引用了https://golang.org/x/下的包,通常會(huì)下載失敗惩嘉,就會(huì)報(bào)這個(gè)錯(cuò)誤。
package golang.org/x/time/rate: unrecognized import path
"golang.org/x/time/rate" (https fetch: Get https://golang.org/x/time/rate?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
上邊想安裝依賴包golang.org/x/time/rate
此時(shí)你去https://github.com/golang/
尋找time
:https://github.com/golang/time.git
解決辦法就是:
$mkdir -p $GOPATH/src/golang.org/x/
$cd $GOPATH/src/golang.org/x/
$git clone https://github.com/golang/time.git time
$go install time
又例如package golang.org/x/net/context: unrecognized
去github找到:
https://github.com/golang/net.git
$mkdir -p $GOPATH/src/golang.org/x/
$cd $GOPATH/src/golang.org/x/
$git clone https://github.com/golang/net.git net
$go install net