Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CodingCaius/gRPC-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

5 Commits

Repository files navigation

环境准备

Protocol Buffer官方文档:https://protobuf.dev/getting-started/gotutorial/

protobuf下载:

https://github.com/protocolbuffers/protobuf

安装gRPC核心库:

go get google.golang.org/grpc

安装go语言的代码生成工具

go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

生成

protoc --go_out=. hello.proto // 生成go代码
protoc --go-grpc_out=. hello.proto // 生成gRPC的代码,用来调用

或者同时生成hello.pb.go 和 hello_grpc.pb.go

protoc --go-grpc_out=. --go_out=. hello.proto

About

演示gRPC基础语法,流式传输,安全连接等

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /