protoc-gen-enum-desc

command module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 11 Imported by: 0

README

protoc-gen-enum-desc

Generate custom description for proto Enum.

Install

go install github.com/nvac/protoc-gen-enum-desc@latest

Usage
  1. copy ./proto/nvac/enum_desc.proto to your proto buffer import path

  2. import option nvac.enum_desc from nvac/enum_desc.proto

    syntax = "proto3";
    
    package example;
    
    import "google/protobuf/descriptor.proto";
    import "nvac/enum_desc.proto";
    
    option go_package = ".;example";
    
    message User {
      Status status = 1;
    }
    
    enum Status {
      Status_Unspecified = 0 [(nvac.enum_desc) = "UNSPECIFIED"];
      Status_Active = 1 [(nvac.enum_desc) = "ACTIVE"];
      Status_Deleted = 2 [(nvac.enum_desc) = "DELETED"];
    }
    
  3. compile with --enum-desc_out

    protoc --proto_path=. \
        --proto_path=./proto \
        --go_out=paths=source_relative:. \
        --enum-desc_out=paths=source_relative:. \
        ./example/user.proto
    

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
proto

Jump to

Keyboard shortcuts

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