编译portainer时,提示golang.org/x/crypto/bcrypt无法安装?

最近在移植Docker管理工具portainer,需要go语言的一些源文件。
 
crypto/crypto.go:4:2: cannot find package "golang.org/x/crypto/bcrypt" in any of:
/usr/lib/golang/src/golang.org/x/crypto/bcrypt (from $GOROOT)
/usr/share/gocode/src/golang.org/x/crypto/bcrypt (from $GOPATH)
http/handler/websocket.go:21:2: cannot find package "golang.org/x/net/websocket" in any of:
/usr/lib/golang/src/golang.org/x/net/websocket (from $GOROOT)
/usr/share/gocode/src/golang.org/x/net/websocket (from $GOPATH)
cli/cli.go:12:2: cannot find package "gopkg.in/alecthomas/kingpin.v2" in any of:
/usr/lib/golang/src/gopkg.in/alecthomas/kingpin.v2 (from $GOROOT)
/usr/share/gocode/src/gopkg.in/alecthomas/kingpin.v2 (from $GOPATH)
手工执行go get,出现错误:
# go get golang.org/x/crypto/bcrypt
package golang.org/x/crypto/bcrypt:
unrecognized import path "golang.org/x/crypto/bcrypt"
(https fetch: Get https://golang.org/x/crypto/bcrypt?go-get=1: dial tcp 61.91.161.217:443: i/o timeout)

请问怎么解决? 
已邀请:

loongnix

赞同来自: zzz19760225


7
down vote
accepted
I found temporary solution.

Library golang.org/x/crypto/bcrypt has mirror on github.

Create folder src/golang.org/x/ into you GOPATH.

mkdir -p $GOPATH/src/golang.org/x/
Then clone crypto from github.

cd $GOPATH/src/golang.org/x/
git clone git@github.com:golang/crypto.git
shareimprove this answer
answered Jul 10 '15 at 9:32

rusnasonov
233517

loongnix

赞同来自:

在这里找到了解决方法:
 
https://stackoverflow.com/questions/31334197/failed-to-install-golang-org-x-crypto-bcrypt
 
方法是在github手工下载源代码,放到$GOPATH目录下。

要回复问题请先登录注册