Linting fixes for the provisioning package (#25690)

This commit is contained in:
Carl Bergquist
2020-06-30 22:46:41 +02:00
committed by GitHub
parent 891ae24f76
commit db8d7ffbf6
7 changed files with 102 additions and 78 deletions
@@ -22,11 +22,14 @@ import (
"github.com/grafana/grafana/pkg/util/errutil"
)
// IntValue represents a string value in a YAML
// config that can be overridden by environment variables
type IntValue struct {
value int
Raw string
}
// UnmarshalYAML converts YAML into an *IntValue
func (val *IntValue) UnmarshalYAML(unmarshal func(interface{}) error) error {
interpolated, err := getInterpolated(unmarshal)
if err != nil {
@@ -41,15 +44,19 @@ func (val *IntValue) UnmarshalYAML(unmarshal func(interface{}) error) error {
return errutil.Wrap("cannot convert value int", err)
}
// Value returns the wrapped int value
func (val *IntValue) Value() int {
return val.value
}
// Int64Value represents a string value in a YAML
// config that can be overridden by environment variables
type Int64Value struct {
value int64
Raw string
}
// UnmarshalYAML converts YAML into an *Int64Value
func (val *Int64Value) UnmarshalYAML(unmarshal func(interface{}) error) error {
interpolated, err := getInterpolated(unmarshal)
if err != nil {
@@ -64,15 +71,19 @@ func (val *Int64Value) UnmarshalYAML(unmarshal func(interface{}) error) error {
return err
}
// Value returns the wrapped int64 value
func (val *Int64Value) Value() int64 {
return val.value
}
// StringValue represents a string value in a YAML
// config that can be overridden by environment variables
type StringValue struct {
value string
Raw string
}
// UnmarshalYAML converts YAML into an *StringValue
func (val *StringValue) UnmarshalYAML(unmarshal func(interface{}) error) error {
interpolated, err := getInterpolated(unmarshal)
if err != nil {
@@ -83,15 +94,19 @@ func (val *StringValue) UnmarshalYAML(unmarshal func(interface{}) error) error {
return err
}
// Value returns the wrapped string value
func (val *StringValue) Value() string {
return val.value
}
// BoolValue represents a string value in a YAML
// config that can be overridden by environment variables
type BoolValue struct {
value bool
Raw string
}
// UnmarshalYAML converts YAML into an *BoolValue
func (val *BoolValue) UnmarshalYAML(unmarshal func(interface{}) error) error {
interpolated, err := getInterpolated(unmarshal)
if err != nil {
@@ -102,15 +117,19 @@ func (val *BoolValue) UnmarshalYAML(unmarshal func(interface{}) error) error {
return err
}
// Value returns the wrapped bool value
func (val *BoolValue) Value() bool {
return val.value
}
// JSONValue represents a string value in a YAML
// config that can be overridden by environment variables
type JSONValue struct {
value map[string]interface{}
Raw map[string]interface{}
}
// UnmarshalYAML converts YAML into an *JSONValue
func (val *JSONValue) UnmarshalYAML(unmarshal func(interface{}) error) error {
unmarshaled := make(map[string]interface{})
err := unmarshal(unmarshaled)
@@ -131,15 +150,19 @@ func (val *JSONValue) UnmarshalYAML(unmarshal func(interface{}) error) error {
return err
}
// Value returns the wrapped JSON value as map[string]interface{}
func (val *JSONValue) Value() map[string]interface{} {
return val.value
}
// StringMapValue represents a string value in a YAML
// config that can be overridden by environment variables
type StringMapValue struct {
value map[string]string
Raw map[string]string
}
// UnmarshalYAML converts YAML into an *StringMapValue
func (val *StringMapValue) UnmarshalYAML(unmarshal func(interface{}) error) error {
unmarshaled := make(map[string]string)
err := unmarshal(unmarshaled)
@@ -159,6 +182,7 @@ func (val *StringMapValue) UnmarshalYAML(unmarshal func(interface{}) error) erro
return err
}
// Value returns the wrapped map[string]string value
func (val *StringMapValue) Value() map[string]string {
return val.value
}