Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Errors & Fixes

lquintai edited this page Dec 15, 2020 · 1 revision

Go projects

General Information

Package Go contract as CDS

  • All Go projects (developed with or without Go modules) need to be a subdirectory of GOPATH

Package Go contract as TAR.GZ

  • Go projects using modules (file go.mod is present) can be anywhere in the filesystem
  • Go projects that do not use modules need to be a subdirectory of GOPATH

Instantiate Go contract CDS

On fabric 2 nodes in channels with 1.4 capabilities

  • The user will need to vendor shim before packaging the contract

On fabric 1.4 nodes in channels with 1.4 capabilities

  • The contracts do not require shim to be vendored

Some possible errors and fixes

chaincode installed to peer but could not build chaincode: external builder failed: external builder failed to build: external builder 'golang' failed: exit status 1

Instantiating a Go contract in a node running fabric 2, with a v1.4 capability channel. Error might be coming from:

  • Not having vendored shim, in case of a project without modules

Fix: vendor shim

  • Contract not a subdirectory of GOPATH

Fix: make sure contract is subdirectory of GOPATH before packaging

error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "can't load package: package </path/to/project>: import "<path/to/project>": cannot import absolute path

Instantiating a Go contract in a node running fabric 1.4, with a v1.4 capability channel. Error might be coming from:

  • Contract not a subdirectory of GOPATH

Fix: make sure contract is subdirectory of GOPATH before packaging