我在使用go get命令安装Fabric CA时遇到了一个错误。

huangapple go评论105阅读模式
英文:

I encountered an error while installing Fabric CA with the go get command

问题

执行以下命令时:

go get -u github.com/hyperledger/fabric-ca/cmd/

我遇到了以下错误:

go get: 在模块模式下使用'go get'安装可执行文件已被弃用。
请改用'go install pkg@version'。
有关更多信息,请参阅https://golang.org/doc/go-get-install-deprecation
或运行'go help get'或'go help install'。
# github.com/hyperledger/fabric-ca/internal/pkg/util
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca@v1.5.2/internal/pkg/util/csp.go:117:12: 未定义:bccsp.RSA2048KeyGenOpts
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca@v1.5.2/internal/pkg/util/csp.go:119:12: 未定义:bccsp.RSA3072KeyGenOpts
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca@v1.5.2/internal/pkg/util/csp.go:121:12: 未定义:bccsp.RSA4096KeyGenOpts
# github.com/hyperledger/fabric-ca/lib/server/operations
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca@v1.5.2/lib/server/operations/system.go:173:23: 调用s.statsd.SendLoop时参数不足
已有(<-chan time.Time, string, string)
需要(context.Context, <-chan time.Time, string, string)

go版本

go version go1.17.2 linux/amd64

英文:

when executing

go get -u github.com/hyperledger/fabric-ca/cmd/

I get the following error:

go get: installing executables with 'go get' in module mode is deprecated.
Use 'go install pkg@version' instead.	
For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.
# github.com/hyperledger/fabric-ca/internal/pkg/util
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca@v1.5.2/internal/pkg/util/csp.go:117:12: undefined: bccsp.RSA2048KeyGenOpts
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca@v1.5.2/internal/pkg/util/csp.go:119:12: undefined: bccsp.RSA3072KeyGenOpts
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca@v1.5.2/internal/pkg/util/csp.go:121:12: undefined: bccsp.RSA4096KeyGenOpts
# github.com/hyperledger/fabric-ca/lib/server/operations
/opt/go/pkg/mod/github.com/hyperledger/fabric-ca@v1.5.2/lib/server/operations/system.go:173:23: not enough arguments in call to s.statsd.SendLoop
	have (<-chan time.Time, string, string)
	want (context.Context, <-chan time.Time, string, string)

go version

go version go1.17.2 linux/amd64

答案1

得分: 0

go 1.17.2 不是 fabric-ca 1.5.2 支持的版本,请查看发布说明以获取支持的版本,链接在这里:https://github.com/hyperledger/fabric-ca/releases/tag/v1.5.2

然而,还存在一个依赖项的问题,该依赖项更改了一个 API,因此在使用 -u 选项进行 go get 时,它将下载并使用一个不兼容的版本。这仅适用于服务器,所以对于服务器,以下命令应该可以工作:

go get github.com/hyperledger/fabric-ca/cmd/fabric-ca-server

但你也可以执行以下命令:

go get github.com/hyperledger/fabric-ca/cmd/...

以包括客户端构建。

当然,你也可以从 https://github.com/hyperledger/fabric-ca/releases/tag/v1.5.2 获取官方构建版本。

英文:

go 1.17.2 isn't a supported version for fabric-ca 1.5.2 check the release notes for the supported version here https://github.com/hyperledger/fabric-ca/releases/tag/v1.5.2

however there is also an issue with a dependency that has changed an api such that using the -u option on go get means that it will download and use an incompatible version. This applies only to the server so for the server

go get github.com/hyperledger/fabric-ca/cmd/fabric-ca-server

should work, but you can also do

go get github.com/hyperledger/fabric-ca/cmd/...

to include a client build as well

You can of course just get official builds from https://github.com/hyperledger/fabric-ca/releases/tag/v1.5.2

huangapple
  • 本文由 发表于 2021年10月14日 14:10:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/69565838.html
匿名

发表评论

匿名网友

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

确定