Protoc

install protoc and required plugins.

Prerequisites

  1. node, yarn

  2. buf

  3. prototool

  4. clang-format

  5. proto

  6. protoc-gen-go

  7. protoc-gen-validate

  8. protoc-gen-grpc-gateway

  9. protoc-gen-grpc-web

  10. protoc-gen-swagger

Installation

# basics
brew install node
brew install yarn

# plugins
yarn global add grpc-tools
brew install protoc-gen-grpc-web
# linter/generator and tool for proto files
GO111MODULE=on go get github.com/uber/prototool/cmd/prototool@dev
# linter tool for proto files
GO111MODULE=on go get github.com/bufbuild/buf/cmd/buf
# VS Code plugin `vscode-proto3` need clang-format
brew install clang-format
# fetch protoc plugins into $GOPATH
GO111MODULE=on go get google.golang.org/protobuf/cmd/protoc-gen-go
GO111MODULE=on go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.0

GO111MODULE=on go get github.com/grpc-ecosystem/grpc-gateway/{protoc-gen-grpc-gateway,protoc-gen-swagger}

# Installing PGV can currently only be done from source:
go get -d github.com/envoyproxy/protoc-gen-validate
cd ~/go/src/github.com/envoyproxy/protoc-gen-validate
git pull
make build

Reference

Last updated