修改 /opt/chaincode/ 目录下的 go.mod, 指定版本,添加如下内容: require ( github.com/golang/protobuf v1.3.2 github.com/hyperledger/fabric-chaincode-go v0.0.0-20200424173110-d7076418f212 github.com/hyperledger/fabric-contract-api-go v1.1.0 github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e github.com/stretchr/testify v1.5.1 golang.org/x/tools v0.1.0 // indirect )
时间: 2023-06-23 09:10:09 浏览: 151
这段代码是在指定 /opt/chaincode/ 目录下的 go.mod 文件中添加依赖项的版本信息,其中:
- github.com/golang/protobuf v1.3.2 :指定 golang 的 protobuf 包版本为 v1.3.2
- github.com/hyperledger/fabric-chaincode-go v0.0.0-20200424173110-d7076418f212 :指定 Fabric 的 chaincode-go 包版本为 v0.0.0-20200424173110-d7076418f212
- github.com/hyperledger/fabric-contract-api-go v1.1.0 :指定 Fabric 的 contract-api-go 包版本为 v1.1.0
- github.com/hyperledger/fabric-protos-go v0.0.0-20200424173316-dd554ba3746e :指定 Fabric 的 protos-go 包版本为 v0.0.0-20200424173316-dd554ba3746e
- github.com/stretchr/testify v1.5.1 :指定 testify 包版本为 v1.5.1
- golang.org/x/tools v0.1.0 // indirect :指定 x/tools 包版本为 v0.1.0,indirect 表示该包是间接依赖项。
通过指定版本,可以确保依赖项版本的稳定性和一致性,从而避免出现因依赖项版本不兼容而导致的问题。
阅读全文
相关推荐


















