- 📄 Know about my experiences https://github.com/keitakn/cv
keitakn / golang-grpc-server Goto Github PK
View Code? Open in Web Editor NEWGoでgRPCを実装する時のサンプルコード
License: MIT License
GoでgRPCを実装する時のサンプルコード
License: MIT License
gRPCのインターフェースなど外部公開が必要な物やgrpcサーバーとgrpc-serverの2つのエンドポイントを持つようになったので、一度ディレクトリ構成を整理する。
そもそもgRPCにサーバー側とかClient側とかいう概念はないが、サンプルコードの役割として名前付けしてあったほうが分かりやすい。
あと同じ .proto
ファイルを読み込む必要があるので、リポジトリが分かれている場合でもそれが出来るかどうか試すという意味もある。
github.com/golang/protobuf
が google.golang.org/protobuf
に変更されている事.proto
からGoのインターフェースが生成出来る事サンプルとは言え、ログの内容に関してはデバッグが出来るだけの最低限の情報は入れておく。
./scripts/docker-compose-up.sh
を走らせると下記のようなエラーが出る。
go get: gopkg.in/urfave/[email protected]: parsing go.mod:
module declares its path as: github.com/urfave/cli/v2
but was required as: gopkg.in/urfave/cli.v2
こちらは oxequa/realize/issues/269 に記載の通り GO111MODULE=off go get github.com/oxequa/realize
とすることで回避できる。
また、oxequa/realize/issues/253, nekochans/portfolio-backend/issues/11 で議論されていた回避策は現時点ではもう必要ないようなので削除。
go get gopkg.in/urfave/cli.v2@master && \
[hiroshi@MacBook-Pro]# git diff [/Users/hiroshi/Development/src/github.com/itohiro73/golang-grpc-server]
diff --git a/build/package/docker/grpc/Dockerfile b/build/package/docker/grpc/Dockerfile
index b685317..188289c 100644
--- a/build/package/docker/grpc/Dockerfile
+++ b/build/package/docker/grpc/Dockerfile
@@ -29,8 +29,7 @@ COPY . .
RUN set -eux && \
go build -o golang-grpc-server ./cmd/grpc/main.go && \
- go get gopkg.in/urfave/cli.v2@master && \
- go get github.com/oxequa/realize && \
+ GO111MODULE=off go get github.com/oxequa/realize && \
go get -u github.com/go-delve/delve/cmd/dlv && \
go build -o /go/bin/dlv github.com/go-delve/delve/cmd/dlv
Dockerfileの
Line 25 in 046c8ca
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.