config

package
v0.0.0-...-862138a Latest Latest
Warning

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

Go to latest
Published: May 29, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Example
package main

import (
	"fmt"

	"github.com/palantir/godel/apps/gonform/config"
)

func main() {
	yml := `
formatters:
  gofmt:
    args:
      - "-s"
`
	cfg, err := config.LoadRawConfig(yml, "")
	if err != nil {
		panic(err)
	}
	fmt.Printf("%q", fmt.Sprintf("%+v", cfg))
}
Output:

"{Formatters:map[gofmt:{Args:[-s]}] Exclude:{Names:[] Paths:[]}}"

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(cfgPath, jsonContent string) (params.Formatters, error)

Types

type Formatter

type Formatter struct {
	// Args specifies the command-line arguments that are provided to the formatter.
	Args []string `yaml:"args" json:"args"`
}

func (*Formatter) ToParams

func (r *Formatter) ToParams() params.Formatter

type Gonform

type Gonform struct {
	// Formatters specifies the configuration used by the formatters. The key is the name of the formatter and the
	// value is the custom configuration for that formatter.
	Formatters map[string]Formatter `yaml:"formatters" json:"formatters"`

	// Exclude specifies the files that should be excluded from formatting.
	Exclude matcher.NamesPathsCfg `yaml:"exclude" json:"exclude"`
}

func LoadRawConfig

func LoadRawConfig(ymlContent, jsonContent string) (Gonform, error)

func (*Gonform) ToParams

func (r *Gonform) ToParams() params.Formatters

Jump to

Keyboard shortcuts

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