cannot find package “golang.org/x/crypto/curve25519 解决方法

今天在Linux下安装Zgrab的时候,当执行最后一步命令“make"的时候,报错如下:

cd cmd/zgrab2 && go build && cd ../..
../../lib/ssh/kex.go:22:2: cannot find package "golang.org/x/crypto/curve25519" in any of:
	/usr/local/go/src/golang.org/x/crypto/curve25519 (from $GOROOT)
	/usr/local/go/bin/src/golang.org/x/crypto/curve25519 (from $GOPATH)
../../lib/ssh/keys.go:28:2: cannot find package "golang.org/x/crypto/ed25519" in any of:
	/usr/local/go/src/golang.org/x/crypto/ed25519 (from $GOROOT)
	/usr/local/go/bin/src/golang.org/x/crypto/ed25519 (from $GOPATH)
../../lib/smb/ntlmssp/crypto.go:9:2: cannot find package "golang.org/x/crypto/md4" in any of:
	/usr/local/go/src/golang.org/x/crypto/md4 (from $GOROOT)
	/usr/local/go/bin/src/golang.org/x/crypto/md4 (from $GOPATH)
../../../../../golang.org/x/net/idna/idna10.0.0.go:25:2: cannot find package "golang.org/x/text/secure/bidirule" in any of:
	/usr/local/go/src/golang.org/x/text/secure/bidirule (from $GOROOT)
	/usr/local/go/bin/src/golang.org/x/text/secure/bidirule (from $GOPATH)
../../../../../golang.org/x/net/idna/idna10.0.0.go:26:2: cannot find package "golang.org/x/text/unicode/bidi" in any of:
	/usr/local/go/src/golang.org/x/text/unicode/bidi (from $GOROOT)
	/usr/local/go/bin/src/golang.org/x/text/unicode/bidi (from $GOPATH)
../../../../../golang.org/x/net/idna/idna10.0.0.go:27:2: cannot find package "golang.org/x/text/unicode/norm" in any of:
	/usr/local/go/src/golang.org/x/text/unicode/norm (from $GOROOT)
	/usr/local/go/bin/src/golang.org/x/text/unicode/norm (from $GOPATH)
../../lib/http/request.go:31:2: cannot find package "golang.org/x/text/width" in any of:
	/usr/local/go/src/golang.org/x/text/width (from $GOROOT)
	/usr/local/go/bin/src/golang.org/x/text/width (from $GOPATH)
../../modules/mongodb/scanner.go:9:2: cannot find package "gopkg.in/mgo.v2/bson" in any of:
	/usr/local/go/src/gopkg.in/mgo.v2/bson (from $GOROOT)
	/usr/local/go/bin/src/gopkg.in/mgo.v2/bson (from $GOPATH)
../../modules/redis/scanner.go:27:2: cannot find package "gopkg.in/yaml.v2" in any of:
	/usr/local/go/src/gopkg.in/yaml.v2 (from $GOROOT)
	/usr/local/go/bin/src/gopkg.in/yaml.v2 (from $GOPATH)
make: *** [Makefile:24:zgrab2] 错误 1

cannot find package

 

解决方法

我在上面的错误代码已经用绿色标记出来了,其根本原因就是以上这些包找不到仅此而已,解决方法也非常的简单。

 

由于各种原因,国内使用 go get 安装 golang 官方包会失败,我们必须手工去github下载这些包了。

 

具体解决方法如下:

cd /usr/local/go/bin/src/golang.org/x #go的安装目录,替换成自己的即可
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/text.git
go get gopkg.in/mgo.v2/bson
go get gopkg.in/yaml.v2

简单给大家延伸一点知识:gopkg.in是Go语言的稳定API;

gopkg.in服务提供了版本化的URL,这些URL提供了正确的元数据,用于将go工具重定向到定义良好的GitHub存储库。强烈建议选择使用此服务的开发人员不要在不更改包URL中的版本的情况下进行任何向后不兼容的更改。此约定提高了依赖代码继续工作的机会,同时依赖于包的发展。

使用gopkg.in的优点是URL更干净,更短,在使用浏览器打开时重定向到godoc.org上的包文档,处理git分支和标签以进行版本控制,最重要的是鼓励采用稳定版本化的API 。

请注意,gopkg.in不包含包代码。相反,go工具被重定向并直接从相应的GitHub存储库获取代码。

yaml该软件包的实际实现是在GitHub中:https://github.com/go-yaml/yaml

 

如果还有其它的包,原理同上,只需要直接去“https://github.com/golang/”这个地址手工克隆下载到本地就可以了。

    A+
发布日期:2019年07月17日 17:59:27  所属分类:Go语言
最后更新时间:2019-07-17 20:37:02
付杰
  • ¥ 15.0元
  • 市场价:15.0元
  • ¥ 398.0元
  • 市场价:598.0元
  • ¥ 798.0元
  • 市场价:1298.0元
  • ¥ 298.0元
  • 市场价:498.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: