config

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultTag = "default"
)

Variables

View Source
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
	Format        FormatConfig
}

func Load

func Load(dir string) (*Config, error)

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.

func LoadSingle added in v0.7.0

func LoadSingle(reader io.Reader, dir string) (*Config, error)

type FormatConfig added in v0.10.0

type FormatConfig struct {
	// Whether to set all JSON fields to their "correct" names.
	JSON bool
	// Whether to set all PB fields to be ordered.
	PB bool
	// List of initialisms to use when formatting JSON.
	Initialisms []string
}

FormatConfig is configuration for the format command.

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`
	Single        bool
}

func (Generator) Code added in v0.6.0

func (g Generator) Code() string

func (Generator) GetParam added in v0.8.0

func (g Generator) GetParam(key string) (string, bool)

func (Generator) HasPostproc added in v0.7.0

func (g Generator) HasPostproc() bool

func (Generator) IsProtoc

func (g Generator) IsProtoc() bool

func (Generator) ParamString

func (g Generator) ParamString() string

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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