sample of protocol buffer with golang
this sample implements two api by using protobuf:
- adduser
- getuser
the protobuf is used to implement the api in 3ways:
- use protobuf as type definition tool (normal.go)
- use protobuf for rpc (rpc.go)
- use protobuf for grpc (gprc.go)
- install brotobuf-all-x.x.x from protobuf
- unzip zip
- cd protobuf-x.x.x
- ./configure
- make
- make check
- sudo make install
go get -u github.com/golang/protobuf/protoc-gen-go
protoc -I=$SRC_DIR --go_out=$DST_DIR $SRC_DIR/addressbook.proto
tutorial: https://developers.google.com/protocol-buffers/docs/gotutorial#compiling-your-protocol-buffers doc: https://developers.google.com/protocol-buffers/docs/proto3