module
Version:
v0.0.0-...-3840bb3
Opens a new window with list of versions in this module.
Published: Nov 21, 2024
License: Apache-2.0
Opens a new window with license information.
README
¶
protobuf
How to install:
-
Install "protocol buffers"
https://github.com/protocolbuffers/protobuf
or
(MacOS)
brew install protobuf
-
Install plugins to generate .go
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
How to upgrade (MacOS):
brew upgrade protobuf
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
How to run:
- Add these 2 important lines to your ~/.bash_profile or ~/.zshrc:
export GO_PATH=~/go
export PATH=$PATH:/$GO_PATH/bin
- Then close your terminal and re-open it, after that run:
source ~/.bash_profile (source ~/.zshrc)
- Run:
Single file
protoc -I. --go_out=plugins=grpc:. your_file_want_to_build.proto
Build all
make
How to test:
- Install clang-format
brew install clang-format
- Generate .clang-format file
clang-format -assume-filename=<any file *.proto you want> -style=llvm -dump-config > .clang-format
EX: clang-format -assume-filename=tnx.proto -style=llvm -dump-config > .clang-format
- Config clang format:
Add or update below line to .clang-format which had been generated prev step.
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
- Add the following to your settings.json file:
"[proto3]": {
"editor.formatOnSave": true,
},
- Double save(Cmd + S) to see the magic
Directories
¶
gen
|
|
|
|
Click to show internal directories.
Click to hide internal directories.