gRPC-golang
自行編譯protobuf
mkdir tmp
cd tmp
git clone https://github.com/google/protobuf
cd protobuf
./autogen.sh
./configure
make
make check
sudo make install
編譯有問題可能需要安裝 autoconf automake libtool
sudo apt-get install autoconf automake libtool
或是直接下載編譯好的檔案 https://github.com/google/protobuf/releases 解壓縮完bin的protoc複製到
/usr/local/bin/
include資料夾底下的檔案複製到
/usr/local/include/
go get -u github.com/golang/protobuf/proto
go get -u github.com/golang/protobuf/protoc-gen-go
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
protoc -I/usr/local/include -I. -I$GOPATH/src -I helloworld/ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis helloworld/helloworld.proto --go_out=plugins=grpc:.
protoc -I/usr/local/include -I. -I$GOPATH/src -I helloworld/ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis helloworld/helloworld.proto --grpc-gateway_out=logtostderr=true:.