formatproto is a post-processor for protoc-gen-star that formats proto files with clang-format
package main
import (
"github.com/chanced/formatproto"
pgs "github.com/lyft/protoc-gen-star"
)
func main() {
pgs.Init(
pgs.DebugEnv("DEBUG"),
).RegisterModule(
// your modules here
).RegisterPostProcessor(
formatproto.PostProcessor(),
).Render()
}
You will also need a .clang-format
file at the root of your directory. An example file:
Language: Proto
BasedOnStyle: google
IndentWidth: 2
You must have clang-format installed.
brew install clang-format
sudo apt install clang-format
Download the binary: https://llvm.org/builds/
MIT