Back to articles
Buf Has Free Protocol Buffer Tooling — Here's Why Teams Are Ditching protoc
How-ToDevOps

Buf Has Free Protocol Buffer Tooling — Here's Why Teams Are Ditching protoc

via Dev.to DevOpsAlex Spinov

protoc is painful. Buf replaces it with a modern, fast, and developer-friendly Protocol Buffer toolchain. What is Buf? Buf is a complete toolchain for Protocol Buffers: linting, breaking change detection, code generation, and a registry — all in one CLI. Quick Start # Install brew install bufbuild/buf/buf # Initialize a project buf config init Project Structure proto/ buf.yaml # Buf configuration buf.gen.yaml # Code generation config user/ v1/ user.proto order/ v1/ order.proto buf.yaml version : v2 modules : - path : proto lint : use : - STANDARD breaking : use : - FILE buf.gen.yaml version : v2 plugins : - local : protoc-gen-es out : src/gen opt : target=ts - local : protoc-gen-connect-es out : src/gen opt : target=ts Key Commands # Lint your proto files buf lint # Check for breaking changes buf breaking --against .git#branch = main # Generate code buf generate # Format proto files buf format -w Linting (Catch Mistakes Early) $ buf lint proto/user/v1/user.proto:5:1: Field name "userId

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
4 views

Related Articles