iris/_examples/response-writer/protobuf
Gerasimos (Makis) Maropoulos 3bd3117182
Some checks failed
CI / Test (1.23.x) (push) Successful in 14m54s
CodeQL / Analyze (go) (push) Failing after 5m7s
update dependencies
2024-12-05 02:09:59 +02:00
..
protos add Context.ReadJSONProtobuf method 2020-06-28 23:05:07 +03:00
go.mod update dependencies 2024-12-05 02:09:59 +02:00
go.sum update dependencies 2024-12-05 02:09:59 +02:00
main.go add Context.ReadJSONProtobuf method 2020-06-28 23:05:07 +03:00
README.md add Context.ReadJSONProtobuf method 2020-06-28 23:05:07 +03:00

Protocol Buffers

The Context.Protobuf(proto.Message) is the method which sends protos to the client. It accepts a proto.Message value.

Note: Iris is using the newest version of the Go protocol buffers implementation. Read more about it at The Go Blog: A new Go API for Protocol Buffers.

  1. Install the protoc-gen-go tool.
$ go get -u google.golang.org/protobuf/cmd/protoc-gen-go@latest
  1. Generate proto
$ protoc -I protos/ protos/hello.proto --go_out=.