proto

module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2023 License: Apache-2.0

README

Vanus Proto

Protobuf files for Vanus

How to use

Setup IDE
  1. install plugin 'Protocol Buffer' in marketplace
  2. config path: Performance -> Language&Framework -> Proto Buffers -> Import paths; and add include and proto directory to
install protogen
# 1. Install with Homebrew
brew install protobuf

# or download https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-osx-x86_64.zip
#unzip protoc-3.19.4-osx-x86_64.zip
#mv bin/protoc $GOPATH/bin/ 

# 2. Install protoc-gen-go, protoc-gen-go-grpc and protoc-gen-go-grpc-mock
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/sorcererxw/protoc-gen-go-grpc-mock@latest
debug

Makefile

The makefile has pre-define some convenient methods to generate go file from proto, see file content for details.

# set package, such as controller, then generate code
package=controller make generate-pb

Use Buf

Install by Homebrew on macOS
brew install bufbuild/buf/buf
Install protoc-gen-go-grpc-mock
go install github.com/sorcererxw/protoc-gen-go-grpc-mock@latest
Generate code
cd proto/proto

buf generate
Editor integration
Visual Studio Code

The Visual Studio Code extension can be downloaded from the in-editor extension browser under the name "Buf" or manually via the extension page. You need to have buf installed to use it.

JetBrain IDEs

IntelliJ IDEA, GoLand and other JetBrains IDEs can be configured with a File Watcher that runs buf lint --path on save and optionally surface issues as warnings or errors in your editor.

See this doc for more details.

Directories

Path Synopsis
pkg
trigger
Package trigger is a generated GoMock package.
Package trigger is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL