最近在用beego
写demo,期间遇到一个问题:
import ( ... "golang.org/x/crypto/scrypt" ... )
在引入scrypt
报错:
get -t -v golang.org/x/crypto/scrypt/... Fetching https://golang.org/x/crypto/scrypt?go-get=1 https fetch failed: Get https://golang.org/x/crypto/scrypt?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. package golang.org/x/crypto/scrypt/...: unrecognized import path "golang.org/x/crypto/scrypt" (https fetch: Get https://golang.org/x/crypto/scrypt?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.)
解决办法是:
在$GOPATH/src/
目录下创建golang.org/x/
目录,如果是windows系统可以使用Git
命令窗口来完成。
mkdir -p $GOPATH/src/golang.org/x/
然后从github拉取golang.org/x/crypto/bcrypt
cd $GOPATH/src/golang.org/x/ git clone git@github.com:golang/crypto.git
操作示例:
参考:
https://stackoverflow.com/questions/31334197/failed-to-install-golang-org-x-crypto-bcrypt