config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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

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.

type Generator

type Generator struct {
	ProtocGen string // The type of protoc generator that should be run; js, python, etc.
	Command   string
	Params    []KeyValue
	ConfigDir string
	Out       string
}

func (Generator) IsProtoc

func (g Generator) IsProtoc() bool

func (Generator) OutPath

func (g Generator) OutPath(packageDir string) string

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 (g Generator) ParamString() string

func (Generator) ParamStringWithOut

func (g Generator) ParamStringWithOut(packageDir string) string

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.

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