Commit 5e875a6f authored by Janoš Guljaš's avatar Janoš Guljaš Committed by GitHub

add protobuf Makefile rule (#194)

parent 14fe4836
GO ?= go
GOLANGCI_LINT ?= golangci-lint
GOLANGCI_LINT_VERSION ?= v1.24.0
GOGOPROTOBUF ?= protoc-gen-gogofaster
GOGOPROTOBUF_VERSION ?= v1.3.1
LDFLAGS ?= -s -w
ifdef COMMIT
......@@ -48,6 +50,16 @@ build:
githooks:
ln -f -s ../../.githooks/pre-push.bash .git/hooks/pre-push
.PHONY: protobuftools
protobuftools:
which protoc || ( echo "install protoc for your system from https://github.com/protocolbuffers/protobuf/releases" && exit 1)
which $(GOGOPROTOBUF) || ( cd /tmp && GO111MODULE=on $(GO) get -u github.com/gogo/protobuf/$(GOGOPROTOBUF)@$(GOGOPROTOBUF_VERSION) )
.PHONY: protobuf
protobuf: GOFLAGS=-mod=mod # use modules for protobuf file include option
protobuf: protobuftools
$(GO) generate -run protoc ./...
.PHONY: clean
clean:
$(GO) clean
......
......@@ -158,6 +158,19 @@ And use that address in the API call on another node, for example, local node 1:
curl -XPOST localhost:8081/pingpong/d4440baf2d79e481c3c6fd93a2014d2e6fe0386418829439f26d13a8253d04f1
```
## Generating protobuf
To process protocol buffer files and generate the Go code from it two tools are needed:
- protoc - https://github.com/protocolbuffers/protobuf/releases
- protoc-gen-gogofaster - https://github.com/gogo/protobuf
Makefile rule `protobuf` can be used to automate `protoc-gen-gogofaster` installation and code generation:
```sh
make protobuf
```
## Contributing
Please read the [coding guidelines](CODING.md).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment