Hyperledger Fabric - Instantiate Chaincode - "go.mod file not found"

518 Views Asked by At

Within my CLI container, I'm able to install the chaincode with no problems, but when I try to instantiate it, it returns the following error.

My GOPATH is set to /opt/gopath in the cli container.
The directory of my chaincode folder in the cli container: /opt/gopath/src/github.com/chaincode.
The instantiate command:
peer chaincode instantiate -o orderer1.iaorderer.com:7050 -C default -n chaincode -l "golang" -v 1.0 -c '{"Args":["InitLedger"]}' --tls --cafile/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/iaorderer/msp/tlscacerts/orderer-tlsca-server.crt

I've run go mod init, go mod tidy and go mod vendor on the chaincode folder already before the cli container mounts the chaincode folder as a volume I've also tried using init,tidy and vendor within the cli container and no difference was made.
I'm wondering if this is a problem with my GO versions being different. I'm running version 1.18 On the host which is what I'm running go mod init, go mod tidy and go mod vendor, and the CLI peer is running version 1.12.12. I cant upgrade it as far as I know since the CLI image comes pre-packaged with 1.12.12 and doesn't have snap. Here is how the go.mod looks after running go mod init after the chaincode code is written and here is how go.mod looks after running go mod tidy

1

There are 1 best solutions below

0
On

Fabric currently does not support Go 1.18. Try downgrading the host's version to 1.17. If there are still issues, attempt to close the gap between the major Go versions of the host and the CLI peer.