Skip to content

Commit

Permalink
Improve lint rules
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <[email protected]>
  • Loading branch information
sagikazarmark committed Sep 11, 2020
1 parent ae12c84 commit a515209
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 24 deletions.
8 changes: 5 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
linters-settings:
gci:
local-prefixes: github.com/spf13/viper
golint:
min-confidence: 0.1
min-confidence: 0
goimports:
local-prefixes: github.com/spf13/viper

Expand All @@ -13,8 +15,10 @@ linters:
- dupl
- exhaustive
- exportloopref
- gci
- goconst
- gofmt
- gofumpt
- goimports
- golint
- goprintffuncname
Expand All @@ -39,14 +43,12 @@ linters:

# fixme
# - errcheck
# - gci
# - gochecknoglobals
# - gochecknoinits
# - gocognit
# - gocritic
# - gocyclo
# - godot
# - gofumpt
# - gosec
# - gosimple
# - lll
Expand Down
10 changes: 5 additions & 5 deletions flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
func TestBindFlagValueSet(t *testing.T) {
flagSet := pflag.NewFlagSet("test", pflag.ContinueOnError)

var testValues = map[string]*string{
testValues := map[string]*string{
"host": nil,
"port": nil,
"endpoint": nil,
}

var mutatedTestValues = map[string]string{
mutatedTestValues := map[string]string{
"host": "localhost",
"port": "6060",
"endpoint": "/public",
Expand Down Expand Up @@ -44,8 +44,8 @@ func TestBindFlagValueSet(t *testing.T) {
}

func TestBindFlagValue(t *testing.T) {
var testString = "testing"
var testValue = newStringValue(testString, &testString)
testString := "testing"
testValue := newStringValue(testString, &testString)

flag := &pflag.Flag{
Name: "testflag",
Expand All @@ -59,7 +59,7 @@ func TestBindFlagValue(t *testing.T) {
assert.Equal(t, testString, Get("testvalue"))

flag.Value.Set("testing_mutate")
flag.Changed = true //hack for pflag usage
flag.Changed = true // hack for pflag usage

assert.Equal(t, "testing_mutate", Get("testvalue"))
}
1 change: 1 addition & 0 deletions overrides_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func TestNestedOverrides(t *testing.T) {
func overrideDefault(assert *assert.Assertions, firstPath string, firstValue interface{}, secondPath string, secondValue interface{}) *Viper {
return overrideFromLayer(defaultLayer, assert, firstPath, firstValue, secondPath, secondValue)
}

func override(assert *assert.Assertions, firstPath string, firstValue interface{}, secondPath string, secondValue interface{}) *Viper {
return overrideFromLayer(overrideLayer, assert, firstPath, firstValue, secondPath, secondValue)
}
Expand Down
4 changes: 2 additions & 2 deletions remote/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"io"
"os"

"github.com/spf13/viper"

crypt "github.com/bketelsen/crypt/config"

"github.com/spf13/viper"
)

type remoteConfigProvider struct{}
Expand Down
6 changes: 4 additions & 2 deletions util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ func TestCopyAndInsensitiviseMap(t *testing.T) {
"Bar": map[interface{}]interface {
}{
"ABc": "A",
"cDE": "B"},
"cDE": "B",
},
}
expected = map[string]interface{}{
"foo": 32,
"bar": map[string]interface {
}{
"abc": "A",
"cde": "B"},
"cde": "B",
},
}
)

Expand Down
Loading

0 comments on commit a515209

Please sign in to comment.