Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
This branch is 3 commits ahead of DirkBrand:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Code Formatter for Protocol Buffer 2.5. Should be used as a stand-alone tool to format entire directories of code, or a plugin for protoc.

To use the protofmt tool:

Install the tool, then run the following on the command-line:

$ protofmt -r=true -proto_path='path' -exclude_path='list of paths' 'path of directory to format

-r is a flag indicating whether to format the directory recursively or not.
-proto_path is used to provide the location of all dependencies.
-exlude_path is used to provide a colon separated list of paths of directories that should not be formatted.

The command will format and override all .proto files in the provided directory (not including the excluded directories).

For use in protoc:

Install the plugin, then have the location of the plugin binary in your PATH variable. Run the following on the command-line:

$ protoc --pretty_out='location of output' 'location of unformatted .proto file'

The command will format the input file and write it in the provided location. If the location is the same as the original file, it will be overwritten.


To install the stand-alone tool, run the following command in the terminal:

$ go get

To install the plugin for protoc, run the following command in the terminal:

$ go get


  1. Formatter cannot preserve order of structures

  2. For comments, outer `extend' groups are logically grouped together, so inner comments are lost

  3. Style of comments are not preserved (/* */ vs. //), so single-line comments are shown with // and multi-line comments with /* */.

  4. When using the protoc plugin, any comments not directly adjacent to a line of code (dangling comments), are not preserved. Comments must be directly above or below a line of code (without newlines). Such comments are preserved when using the protofmt tool.

Build Status


Code Formatter for Protocol Buffer. Should be used a stand-alone tool, but will be extended as a plugin for sublime.






No packages published


  • Protocol Buffer 64.0%
  • Go 36.0%