Skip to content

clearcodecn/go-protobuf-01

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grpc Starter

This is a simple starter for grpc with golang and protobuf.

欢迎加入学习群 https://github.com/clearcodecn/leveldb-demo/raw/master/images/qr.png

Resources

Installation

install protoc
  protobuf  tree -l
.
├── bin
 └── protoc                # 二进制文件
├── include
 └── google
     └── protobuf          # protobuf 相关的 proto 文件
         ├── any.proto
         ├── api.proto
         ├── compiler
          └── plugin.proto
         ├── descriptor.proto
         ├── duration.proto
         ├── empty.proto
         ├── field_mask.proto
         ├── source_context.proto
         ├── struct.proto
         ├── timestamp.proto
         ├── type.proto
         └── wrappers.proto
└── readme.txt             # 说明文件
5 directories, 14 files
  • 执行命令, 检查安装情况.
☁  protobuf  ./bin/protoc --version
libprotoc 22.3
  • 将 protoc 所在目录添加到环境变量
> 查看所在目录 
$ pwd
> /tmp/protobuf

$ export PATH=$PATH:/tmp/protobuf/bin   # 临时添加到当前终端 , 永久添加则需要修改 ~/.bash_profile 文件
$ protoc --version
> libprotoc 22.3
安装 go protobuf 相关套件.
$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
编译protobuf:
make build-proto

使用 GRPC

  1. 安装 文档
$ go install google.golang.org/protobuf/cmd/[email protected]
$ go install google.golang.org/grpc/cmd/[email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published