Skip to content

kfrico/gRPC-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

gRPC-golang

gRPC-golang

環境設定

安裝protobuf

  自行編譯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/

 

下載proto套件

go get -u github.com/golang/protobuf/proto

 

下載protoc轉go的套件

go get -u github.com/golang/protobuf/protoc-gen-go

 

下載gRPC轉gateway的套件

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

 

proto編譯成grpc go檔

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:.

 

proto編譯成grpc gateway go檔

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:.

About

gRPC-golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published