protoc-gen-protolint

command
v0.49.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 2 Imported by: 0

README

protoc-gen-protolint

Installation

Download protoc-gen-protolint and make sure it's available in your PATH. Once it's in your PATH, protoc will be able to make use of the plug-in.

Via Homebrew

protoc-gen-protolint can be installed for Mac or Linux using Homebrew via the yoheimuta/protolint tap.

brew tap yoheimuta/protolint
brew install protolint
Via GitHub Releases

You can also download a pre-built binary from this release page:

In the downloads section of each release, you can find pre-built binaries in .tar.gz packages.

Via Maven Central

This plugin is also available on Maven Central. For details about how to use it, check out the gradle example.

From Source

The binary can be installed from source if Go is available. However, I recommend using one of the pre-built binaries instead because it doesn't include the version info.

go get -u -v github.com/yoheimuta/protolint/cmd/protoc-gen-protolint

Usage

protoc --protolint_out=. *.proto

A version subcommand is supported.

protoc-gen-protolint version

All flags, which is supported by protolint are passed as an option to the plugin as a comma separated text. It should look like below.

protoc \
    --protolint_out=. \
    --protolint_opt=v,fix,config_dir_path=_example/config,reporter=junit,plugin=./plugin_example \
    *.proto
With Grpc.Tools package (.NET Build)

When you specify ProtoRoot, make sure to add --proto_root option like the below.

<ItemGroup>
  <Protobuf Include="protos\**\*.proto" AdditionalProtocArguments="--protolint_out=.;--protolint_opt=proto_root=protos" ProtoRoot="protos" />
</ItemGroup>

Option

proto_root

If you add protoc's --proto_path to read your proto files in the specified directory, protolint could fail to locate the proto files. You should tell protolint the root directory like the below.

❯ ls protos
helloworld.proto

❯ protoc \
    --proto_path=protos
    --protolint_out=. \
    --protolint_opt=proto_root=protos \
    helloworld.proto

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL