- Golang: sample instructions (Version 1.15 or above)
- Protoc (Protobuf compiler): Golang should already be installed and configured.
- Default method: Run the following with
sudo
if necessary. This will install both the protobuf compiler and the Go code generator plugin.apt-get install protobuf-compiler go get -u google.golang.org/protobuf/cmd/protoc-gen-go go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc
- If the above method installs an older version of
protoc
(check usingprotoc --version
), say below 3.12.x, you should download pre-compiled binaries instead. (With an older version, you may see errors while attempting to launch and setup the Fabric networks).Note: The latest version at present issudo apt-get remove protobuf-compiler curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip sudo apt-get install unzip unzip protoc-3.15.6-linux-x86_64.zip -d <some-folder-path> export PATH="$PATH:<some-folder-path>/bin" go get -u google.golang.org/protobuf/cmd/protoc-gen-go go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc
3.15.6
, but you should check the above link to find the most current version before running the above steps.
- Default method: Run the following with
To build, run:
make build
To clean, run:
make clean
To clean the builds, run:
make clean-build
- Just add
github.com/hyperledger/cacti/weaver/common/protos-go
to your imports, to use it. - Run
go mod tidy
to populate yourgo.mod
with the latest version.
- After building, pushing into github already publishes it.
- To have proper versions (by default go uses commit id as version if there are no git tag created), tag the commit in Git, with format:
common/protos-go/va.b.c
, where:a
: Major Version.b
: Minor Version.c
: Patch Version.