https://github.com/chanced/formatproto
format-proto is a post-processor for protoc-gen-star that formats proto files with clang-format
https://github.com/chanced/formatproto
Last synced: 9 months ago
JSON representation
format-proto is a post-processor for protoc-gen-star that formats proto files with clang-format
- Host: GitHub
- URL: https://github.com/chanced/formatproto
- Owner: chanced
- License: mit
- Created: 2021-01-14T21:36:25.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-14T21:56:37.000Z (over 5 years ago)
- Last Synced: 2023-03-15T22:25:22.969Z (about 3 years ago)
- Language: Go
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# formatproto
formatproto is a post-processor for [protoc-gen-star](https://github.com/lyft/protoc-gen-star) that formats proto files with [clang-format](https://clang.llvm.org/docs/ClangFormatStyleOptions.html)
## Usage:
```go
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:
```yaml
Language: Proto
BasedOnStyle: google
IndentWidth: 2
```
## Prereqs:
You must have clang-format installed.
### MacOS
`brew install clang-format`
### Linux (with apt)
`sudo apt install clang-format`
### Windows
Download the binary: [https://llvm.org/builds/](https://llvm.org/builds/)
## License
MIT