Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 2.34 KB

README.md

File metadata and controls

53 lines (39 loc) · 2.34 KB

go-gw-protoc

A docker container to compile Protocol Buffers with protoc-gen-grpc-gateway

release publish-docker-image license

The Docker image is available on [Docker Hub][docker-hub]

It is based on golang:1.13-buster and adds all the packages needed for using protoc to compile your Protocol Buffers for gRPC and grpc-gateway

You can generate the gRPC and gRPC-gateway go source with:

docker run --rm -v ${PWD}:/source diebietse/go-gw-protoc -I. --go_out=plugins=grpc:. --grpc-gateway_out=logtostderr=true:. hello-world.proto

To test it go to the example folder, run build.sh and it will create hello-world.pb.go and hello-world.pb.gw.go

To use gogofaster for source code generation use

docker run --rm -v ${PWD}:/source diebietse/go-gw-protoc -I. --gogofaster_out=plugins=grpc:. --grpc-gateway_out=logtostderr=true:. hello-world.proto

Gogofaster can also be used to generate marshallers and unmarshallers as well as a host of other options. For an example of that run

docker run --rm -v ${PWD}:/source diebietse/go-gw-protoc -I. --gogofaster_out=plugins=grpc:. --grpc-gateway_out=logtostderr=true:. hello-worldgogo.proto
docker run --rm -v ${PWD}:/source diebietse/go-gw-protoc:latest \
-I./ \
-I/usr/local/include \
--go_out=paths=source_relative,plugins=grpc:./ \
--validate_out="lang=go:./" \
hello-world-validate.proto

See https://github.com/gogo/protobuf for more information.