FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

infiniteloopcloud/protoc-gen-go-types: Fork of Protobuf Golang specialized for type generation · GitHub

 
 

Repository files navigation

Fork of Protobuf Golang specialized for type generation

This package supposed to focus on type generation based on proto file.

Features compared to original repository

  • Flags to REMOVE protobuf specific field generation
  • Make difference between optional and non-optional in case of structs. So it's generating non-pointer in case of non-optional

Installation

go install github.com/infiniteloopcloud/protoc-gen-go-types@latest

Flags

These are actually environment variables.

  • SKIP_PROTOBUF_SPECIFIC=false - Skip protobuf specific code
  • TYPE_OVERRIDE - Enable type override

Type override

Supported overwrite:

  • TimeTime -> time.Time
  • RepeatedString -> []string

Example

syntax = "proto3";

message SomeStruct {
  TimeTime created_at = 1; // This will be time.Time
}

message TimeTime {}

Important

Currently the overwritten FieldOptions (go_type, go_import, go_import_alias, go_zero_override) must be paired with these numbers: go_type = 1001 go_import = 1002 go_import_alias = 1003 go_zero_override = 1004 go_struct_tags = 1005 Because protoc can't process the extended options, so we can't find the by name, just by place.

About

Fork of Protobuf Golang specialized for type generation

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL