Documentation
¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/palantir/checks/gogenerate/config" ) func main() { yml := ` generators: foo: go-generate-dir: testbar gen-paths: names: - "bar" paths: - "testbar/output.txt" environment: GOOS: darwin ` cfg, err := config.LoadFromStrings(yml, "") if err != nil { panic(err) } fmt.Printf("%q", fmt.Sprintf("%+v", cfg)) }
Output: "{Generators:map[foo:{GoGenDir:testbar GenPaths:{Names:[bar] Paths:[testbar/output.txt]} Environment:map[GOOS:darwin]}]}"
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeneratorConfig ¶
type GeneratorConfig struct { // GoGenDir is the relative path to the directory in which "go generate" should be run. GoGenDir string `yaml:"go-generate-dir" json:"go-generate-dir"` // GenPaths is the configuration that specifies the criteria for matching the output files and directories // generated by the "go generate" command. Any file or directory that is matched by the matchers are used to // determine whether or not the "go generate" command caused any changes. GenPaths matcher.NamesPathsCfg `yaml:"gen-paths" json:"gen-paths"` // Environment specifies values for the environment variables that should be set for the generator. For example, the // following would set GOOS to "darwin" and GOARCH to "amd64": // // environment: // GOOS: darwin // GOARCH: amd64 Environment map[string]string `yaml:"environment" json:"environment"` }
type Generators ¶
type Generators map[string]GeneratorConfig
func (Generators) SortedKeys ¶
func (g Generators) SortedKeys() []string
type GoGenerate ¶
type GoGenerate struct { // Generators is a map from the name of a generator to its configuration. Generators Generators `yaml:"generators" json:"generators"` }
func Load ¶
func Load(configPath, jsonContent string) (GoGenerate, error)
func LoadFromStrings ¶
func LoadFromStrings(ymlContent, _ string) (GoGenerate, error)
Click to show internal directories.
Click to hide internal directories.