Skip to content

Commit 03a1d5a

Browse files
committed
build: fix lint violations
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
1 parent 176aee0 commit 03a1d5a

File tree

3 files changed

+36
-33
lines changed

3 files changed

+36
-33
lines changed

logger.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
)
88

99
// Logger is a unified interface for various logging use cases and practices, including:
10-
// - leveled logging
11-
// - structured logging
10+
// - leveled logging
11+
// - structured logging
1212
type Logger interface {
1313
// Trace logs a Trace event.
1414
//

viper.go

+30-27
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ type DecoderConfigOption func(*mapstructure.DecoderConfig)
132132
// DecodeHook returns a DecoderConfigOption which overrides the default
133133
// DecoderConfig.DecodeHook value, the default is:
134134
//
135-
// mapstructure.ComposeDecodeHookFunc(
136-
// mapstructure.StringToTimeDurationHookFunc(),
137-
// mapstructure.StringToSliceHookFunc(","),
138-
// )
135+
// mapstructure.ComposeDecodeHookFunc(
136+
// mapstructure.StringToTimeDurationHookFunc(),
137+
// mapstructure.StringToSliceHookFunc(","),
138+
// )
139139
func DecodeHook(hook mapstructure.DecodeHookFunc) DecoderConfigOption {
140140
return func(c *mapstructure.DecoderConfig) {
141141
c.DecodeHook = hook
@@ -156,18 +156,18 @@ func DecodeHook(hook mapstructure.DecodeHookFunc) DecoderConfigOption {
156156
//
157157
// For example, if values from the following sources were loaded:
158158
//
159-
// Defaults : {
160-
// "secret": "",
161-
// "user": "default",
162-
// "endpoint": "https://localhost"
163-
// }
164-
// Config : {
165-
// "user": "root"
166-
// "secret": "defaultsecret"
167-
// }
168-
// Env : {
169-
// "secret": "somesecretkey"
170-
// }
159+
// Defaults : {
160+
// "secret": "",
161+
// "user": "default",
162+
// "endpoint": "https://localhost"
163+
// }
164+
// Config : {
165+
// "user": "root"
166+
// "secret": "defaultsecret"
167+
// }
168+
// Env : {
169+
// "secret": "somesecretkey"
170+
// }
171171
//
172172
// The resulting config will have the following values:
173173
//
@@ -785,7 +785,8 @@ func (v *Viper) searchMapWithPathPrefixes(
785785
// isPathShadowedInDeepMap makes sure the given path is not shadowed somewhere
786786
// on its path in the map.
787787
// e.g., if "foo.bar" has a value in the given map, it “shadows”
788-
// "foo.bar.baz" in a lower-priority map
788+
//
789+
// "foo.bar.baz" in a lower-priority map
789790
func (v *Viper) isPathShadowedInDeepMap(path []string, m map[string]interface{}) string {
790791
var parentVal interface{}
791792
for i := 1; i < len(path); i++ {
@@ -810,7 +811,8 @@ func (v *Viper) isPathShadowedInDeepMap(path []string, m map[string]interface{})
810811
// isPathShadowedInFlatMap makes sure the given path is not shadowed somewhere
811812
// in a sub-path of the map.
812813
// e.g., if "foo.bar" has a value in the given map, it “shadows”
813-
// "foo.bar.baz" in a lower-priority map
814+
//
815+
// "foo.bar.baz" in a lower-priority map
814816
func (v *Viper) isPathShadowedInFlatMap(path []string, mi interface{}) string {
815817
// unify input map
816818
var m map[string]interface{}
@@ -835,7 +837,8 @@ func (v *Viper) isPathShadowedInFlatMap(path []string, mi interface{}) string {
835837
// isPathShadowedInAutoEnv makes sure the given path is not shadowed somewhere
836838
// in the environment, when automatic env is on.
837839
// e.g., if "foo.bar" has a value in the environment, it “shadows”
838-
// "foo.bar.baz" in a lower-priority map
840+
//
841+
// "foo.bar.baz" in a lower-priority map
839842
func (v *Viper) isPathShadowedInAutoEnv(path []string) string {
840843
var parentKey string
841844
for i := 1; i < len(path); i++ {
@@ -856,11 +859,11 @@ func (v *Viper) isPathShadowedInAutoEnv(path []string) string {
856859
// would return a string slice for the key if the key's type is inferred by
857860
// the default value and the Get function would return:
858861
//
859-
// []string {"a", "b", "c"}
862+
// []string {"a", "b", "c"}
860863
//
861864
// Otherwise the Get function would return:
862865
//
863-
// "a b c"
866+
// "a b c"
864867
func SetTypeByDefaultValue(enable bool) { v.SetTypeByDefaultValue(enable) }
865868

866869
func (v *Viper) SetTypeByDefaultValue(enable bool) {
@@ -1137,9 +1140,8 @@ func (v *Viper) BindPFlags(flags *pflag.FlagSet) error {
11371140
// BindPFlag binds a specific key to a pflag (as used by cobra).
11381141
// Example (where serverCmd is a Cobra instance):
11391142
//
1140-
// serverCmd.Flags().Int("port", 1138, "Port to run Application server on")
1141-
// Viper.BindPFlag("port", serverCmd.Flags().Lookup("port"))
1142-
//
1143+
// serverCmd.Flags().Int("port", 1138, "Port to run Application server on")
1144+
// Viper.BindPFlag("port", serverCmd.Flags().Lookup("port"))
11431145
func BindPFlag(key string, flag *pflag.Flag) error { return v.BindPFlag(key, flag) }
11441146

11451147
func (v *Viper) BindPFlag(key string, flag *pflag.Flag) error {
@@ -1972,9 +1974,10 @@ func (v *Viper) AllKeys() []string {
19721974

19731975
// flattenAndMergeMap recursively flattens the given map into a map[string]bool
19741976
// of key paths (used as a set, easier to manipulate than a []string):
1975-
// - each path is merged into a single key string, delimited with v.keyDelim
1976-
// - if a path is shadowed by an earlier value in the initial shadow map,
1977-
// it is skipped.
1977+
// - each path is merged into a single key string, delimited with v.keyDelim
1978+
// - if a path is shadowed by an earlier value in the initial shadow map,
1979+
// it is skipped.
1980+
//
19781981
// The resulting set of paths is merged to the given shadow set at the same time.
19791982
func (v *Viper) flattenAndMergeMap(shadow map[string]bool, m map[string]interface{}, prefix string) map[string]bool {
19801983
if shadow != nil && prefix != "" && shadow[prefix] {

viper_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"bytes"
1010
"encoding/json"
1111
"io"
12-
"io/ioutil"
12+
"io/ioutil" //nolint:staticcheck
1313
"os"
1414
"os/exec"
1515
"path"
@@ -998,7 +998,7 @@ func TestBindPFlags(t *testing.T) {
998998
}
999999
}
10001000

1001-
// nolint: dupl
1001+
//nolint:dupl
10021002
func TestBindPFlagsStringSlice(t *testing.T) {
10031003
tests := []struct {
10041004
Expected []string
@@ -1046,7 +1046,7 @@ func TestBindPFlagsStringSlice(t *testing.T) {
10461046
}
10471047
}
10481048

1049-
// nolint: dupl
1049+
//nolint:dupl
10501050
func TestBindPFlagsStringArray(t *testing.T) {
10511051
tests := []struct {
10521052
Expected []string
@@ -1094,7 +1094,7 @@ func TestBindPFlagsStringArray(t *testing.T) {
10941094
}
10951095
}
10961096

1097-
// nolint: dupl
1097+
//nolint:dupl
10981098
func TestBindPFlagsIntSlice(t *testing.T) {
10991099
tests := []struct {
11001100
Expected []int

0 commit comments

Comments
 (0)