Hyperlegder Fabric Golang SDK is notoriously difficult to configure and use. Here is an end to end demo showing how to install and invoke a chaincode on the new "test-network" of Fabric 2.0 using Golang SDK.
First, install dependencies following Fabric Docs.
Then, clone the code and cd
into it:
git clone ...
cd fabric-sdk-go-demo
Then, install Fabric:
# run the following cmd in repo root folder
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s -- 2.0.1 1.4.6 0.4.18
cd fabric-samples
# Disable fabric chaincode lifecycle which in not support in Fabric Golang SDK yet
git apply ../fabric-samples.patch
cd test-network
# Launch Fabric network
./network.sh up createChannel -s couchdb
# return to project folder
cd ../..
go test