diff --git a/.golangci.yml b/.golangci.yml index 0fb8f95..fbfe68a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,46 +9,23 @@ linters-settings: check-shadowing: true linters: - enable: - - deadcode - - errcheck - - errorlint - - exportloopref - - forcetypeassert - - goconst - - gocritic - - godot - - gofmt - - gofumpt - - goimports + enable-all: true + disable: + - wsl + - exhaustivestruct + - exhaustruct + - exhaustive + - godox + - funlen - gomnd - - gosec - - gosimple - - govet - - ifshort - - ineffassign - - misspell - - noctx - - prealloc - - revive - - rowserrcheck - - sqlclosecheck - - staticcheck - - structcheck - - typecheck - - unconvert - - unparam - - unused - - varcheck - - wastedassign + - gocognit + - cyclop issues: exclude-rules: - # Exclude shadow checking on the variable named err - text: "shadow: declaration of \"err\"" - linters: - - govet - # Exclude magic number detection - - text: "mnd: Magic number" - linters: - - gomnd + linters: ["govet"] + - text: "use of `fmt.Print" + linters: ["forbidigo"] + - text: "is too short for the scope of its usage" + linters: ["varnamelen"] diff --git a/cmd/yaml-diff/main.go b/cmd/yaml-diff/main.go index b1ab2db..8023f9e 100644 --- a/cmd/yaml-diff/main.go +++ b/cmd/yaml-diff/main.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "io/ioutil" + "io" "log" "os" @@ -34,12 +34,14 @@ func load(f string) string { defer func() { _ = file.Close() }() if err != nil { log.Printf("%+v, %s", err, f) + return "" } - b, err := ioutil.ReadAll(file) + b, err := io.ReadAll(file) if err != nil { log.Printf("%+v, %s", err, f) + return "" } diff --git a/yamldiff/diff.go b/yamldiff/diff.go index ca10b40..41f2e16 100644 --- a/yamldiff/diff.go +++ b/yamldiff/diff.go @@ -40,6 +40,7 @@ func Do(list1 RawYamlList, list2 RawYamlList) Diffs { return d } } + return nil }, func(diffs []*Diff) *Diff { diff --git a/yamldiff/yaml.go b/yamldiff/yaml.go index fba6153..e19d49a 100644 --- a/yamldiff/yaml.go +++ b/yamldiff/yaml.go @@ -24,5 +24,6 @@ func newRawYaml(raw interface{}) *RawYaml { func randInt() int64 { n, _ := rand.Int(rand.Reader, big.NewInt(math.MaxInt64)) + return n.Int64() }