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: 9 Imported by: 0

Documentation

Overview

Example
package main

import (
	"fmt"

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

func main() {
	yml := `
release-tag: go1.7
checks:
  errcheck:
    args:
      - "-ignore"
      - "github.com/seelog:(Info|Warn|Error|Critical)f?"
    filters:
      - type: "message"
        value: "\\w+"
`
	cfg, err := config.LoadRawConfig(yml, "")
	if err != nil {
		panic(err)
	}
	if _, err := cfg.ToParams(); err != nil {
		panic(err)
	}
	fmt.Printf("%q", fmt.Sprintf("%+v", cfg))
}
Output:

"{ReleaseTag:go1.7 Checks:map[errcheck:{Skip:false Args:[-ignore github.com/seelog:(Info|Warn|Error|Critical)f?] Filters:[{Type:message Value:\\w+}]}] Exclude:{Names:[] Paths:[]}}"

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(configPath, jsonContent string) (params.OKGo, error)

Types

type Checker

type Checker struct {
	// Skip specifies whether or not the check should be skipped entirely.
	Skip bool `yaml:"skip" json:"skip"`

	// Args specifies the command-line arguments provided to the check.
	Args []string `yaml:"args" json:"args"`

	// Filters specifies the filter definitions. Raw output lines that match the filter are excluded from
	// processing.
	Filters []Filter `yaml:"filters" json:"filters"`
}

func (*Checker) ToParam

func (r *Checker) ToParam() (params.Checker, error)

type Filter

type Filter struct {
	// Type specifies the type of the filter: "message", "name" or "path". If blank, defaults to "message".
	Type string `yaml:"type" json:"type"`

	// The value of the filter.
	Value string `yaml:"value" json:"value"`
}

type OKGo

type OKGo struct {
	// ReleaseTag specifies the newest Go release build tag supported by the codebase being checked. If this value
	// is not specified, it defaults to the Go release that was used to build the check tool. If the code being
	// checked is known to use a version of Go that is earlier than the version of Go used to build the check tool
	// and the codebase being checked contains build tags for the newer Go version, this value should be explicitly
	// set. For example, if the check tool was compiled using Go 1.8 but the codebase being checked uses Go 1.7 and
	// contains files that use the "// +build go1.8" build tag, then this should be set to "go1.7".
	ReleaseTag string `yaml:"release-tag" json:"release-tag"`

	// Checks specifies the configuration used by the checks. The key is the name of the check and the value is the
	// custom configuration for that check.
	Checks map[string]Checker `yaml:"checks" json:"checks"`

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

func LoadRawConfig

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

func (*OKGo) ToParams

func (r *OKGo) ToParams() (params.OKGo, error)

Jump to

Keyboard shortcuts

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