Documentation
¶
Index ¶
- Variables
- type Config
- type Generator
- func (g Generator) Code() string
- func (g Generator) GetParam(key string) (string, bool)
- func (g Generator) HasPostproc() bool
- func (g Generator) IsProtoc() bool
- func (g Generator) OutPath(packageDir string) string
- func (g Generator) ParamString() string
- func (g Generator) ParamStringWithOut(packageDir string) string
- type KeyValue
Constants ¶
This section is empty.
Variables ¶
var ProtocBuiltinLanguages = map[string]bool{ "cpp": true, "java": true, "python": true, "php": true, "ruby": true, "csharp": true, "objc": true, "js": true, }
from https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/compiler/main.cc hardcode what languages are built-in in protoc, rest must have their own generator binary
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Dir string
Out string
ImportPath string
ProtocPath string
ProtocVersion string
Generators []Generator
}
func Load ¶
Load will attempt to find the .gunkconfig in the 'dir', working its way up to each parent looking for a .gunkconfig. Currently, Load will only stop when it is unable to go any further up the directory structure or until it finds a 'go.mod' file, or a '.git' file or folder.
Passing in an empty 'dir' will tell Load to look in the current working directory.
type Generator ¶
type Generator struct {
ProtocGen string // The type of protoc generator that should be run; js, python, etc.
Command string
PluginVersion string // we can pin a protoc-gen-XX version
Params []KeyValue
ConfigDir string
Out string
JSONPostProc bool
FixPaths bool
Shortened bool // only for `gunk vet`
}
func (Generator) HasPostproc ¶ added in v0.7.0
func (Generator) OutPath ¶
OutPath determines the path for a generator to write generated files to. It will use 'packageDir' if no 'out' key was set in the config.
func (Generator) ParamString ¶
func (Generator) ParamStringWithOut ¶
ParamStringWithOut will return the generator paramaters formatted for protoc, including where protoc should output the generated files. It will use 'packageDir' if no 'out' key was set in the config.