diff --git a/.dockerignore b/.dockerignore index 1a574f0d..0e523887 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2021-08-11T16:23:52Z by kres c77e3bf-dirty. +# Generated on 2021-08-11T16:38:33Z by kres b894ecf-dirty. ** !cmd diff --git a/.golangci.yml b/.golangci.yml index c3e55daf..f9faee5b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,7 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2021-08-11T16:25:38Z by kres c77e3bf-dirty. +# Generated on 2021-08-11T16:38:33Z by kres b894ecf-dirty. -# options for analysis running run: timeout: 10m issues-exit-code: 1 @@ -13,7 +12,6 @@ run: skip-files: [] modules-download-mode: readonly -# output configuration options output: format: colored-line-number print-issued-lines: true @@ -21,49 +19,42 @@ output: uniq-by-line: true path-prefix: "" -# all available settings of specific linters linters-settings: - dogsled: - max-blank-identifiers: 2 - dupl: - threshold: 150 + cyclop: + max-complexity: 20 errcheck: check-type-assertions: true check-blank: true + errorlint: + errorf: false # https://github.com/polyfloyd/go-errorlint#fmterrorf-wrapping-verb exhaustive: - default-signifies-exhaustive: false - funlen: - lines: 60 - statements: 40 + default-signifies-exhaustive: true gci: local-prefixes: github.com/talos-systems/kres - gocognit: - min-complexity: 30 - nestif: - min-complexity: 5 - goconst: - min-len: 3 - min-occurrences: 3 gocritic: disabled-checks: [] gocyclo: min-complexity: 20 godot: - check-all: false + scope: all # FIXME `declarations`, `toplevel`, or `all` + capital: true # FIXME godox: - keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting - - NOTE + keywords: - OPTIMIZE # marks code that should be optimized before merging - HACK # marks hack-arounds that should be removed before merging - gofmt: - simplify: true + gofumpt: + lang-version: "1.16" + goheader: + template: | + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. goimports: local-prefixes: github.com/talos-systems/kres - golint: - min-confidence: 0.8 - gomnd: - settings: {} gomodguard: {} + gosimple: + go: "1.16" + checks: ["all"] govet: check-shadowing: true enable-all: true @@ -76,41 +67,32 @@ linters-settings: misspell: locale: US ignore-words: [] - nakedret: - max-func-lines: 30 - prealloc: - simple: true - range-loops: true # Report preallocation suggestions on range loops, true by default - for-loops: false # Report preallocation suggestions on for loops, false by default nolintlint: allow-unused: false allow-leading-space: false allow-no-explanation: [] - require-explanation: false + require-explanation: true require-specific: true - rowserrcheck: {} - testpackage: + staticcheck: + go: "1.16" + checks: ["all"] + stylecheck: + go: "1.16" unparam: check-exported: false unused: - check-exported: false - whitespace: - multi-if: false # Enforces newlines (or comments) after every multi-line if statement - multi-func: false # Enforces newlines (or comments) after every multi-line function signature + go: "1.16" wsl: - strict-append: true + allow-assign-and-anything: false allow-assign-and-call: true - allow-multiline-assign: true allow-cuddle-declarations: false + allow-multiline-assign: true + allow-separated-leading-comment: false allow-trailing-comment: false force-case-trailing-whitespace: 0 force-err-cuddling: false - allow-separated-leading-comment: false - gofumpt: - extra-rules: false - cyclop: - # the maximal code complexity to report - max-complexity: 20 + force-short-decl-cuddling: false + strict-append: true linters: enable-all: true @@ -125,10 +107,16 @@ linters: - gochecknoinits - godox - goerr113 + - golint # deprecated, replaced by revive - gomnd + - ifshort # https://github.com/esimonov/ifshort/issues/7 + - interfacer # deprecated due to bad suggestions + - maligned # deprecated, replaced by govet's fieldalignment - nestif - paralleltest - - tagliatelle + - scopelint # deprecated, replaced by exportloopref + - tagliatelle # until https://github.com/ldez/tagliatelle/issues/2 is implemented in golangci-lint + - thelper - typecheck - wrapcheck diff --git a/Dockerfile b/Dockerfile index d30a24b5..784357bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2021-08-11T16:23:52Z by kres c77e3bf-dirty. +# Generated on 2021-08-11T16:38:33Z by kres b894ecf-dirty. ARG TOOLCHAIN diff --git a/internal/output/golangci/golangci.go b/internal/output/golangci/golangci.go index 59023398..739452ac 100644 --- a/internal/output/golangci/golangci.go +++ b/internal/output/golangci/golangci.go @@ -25,6 +25,7 @@ type Output struct { output.FileAdapter canonicalPath string + goVersion string enabled bool } @@ -32,6 +33,7 @@ type Output struct { func NewOutput() *Output { output := &Output{ canonicalPath: "github.com/example.com/example.proj", + goVersion: "1.16", } output.FileAdapter.FileWriter = output @@ -84,7 +86,7 @@ func (o *Output) config(w io.Writer) error { return err } - if _, err := fmt.Fprintf(w, configTemplate, o.canonicalPath); err != nil { + if _, err := fmt.Fprintf(w, configTemplate, o.canonicalPath, o.goVersion); err != nil { return err } diff --git a/internal/output/golangci/golangci.yml b/internal/output/golangci/golangci.yml index 228ea97d..8ad3aa9a 100644 --- a/internal/output/golangci/golangci.yml +++ b/internal/output/golangci/golangci.yml @@ -1,4 +1,3 @@ -# options for analysis running run: timeout: 10m issues-exit-code: 1 @@ -9,7 +8,6 @@ run: skip-files: [] modules-download-mode: readonly -# output configuration options output: format: colored-line-number print-issued-lines: true @@ -17,49 +15,42 @@ output: uniq-by-line: true path-prefix: "" -# all available settings of specific linters linters-settings: - dogsled: - max-blank-identifiers: 2 - dupl: - threshold: 150 + cyclop: + max-complexity: 20 errcheck: check-type-assertions: true check-blank: true + errorlint: + errorf: false # https://github.com/polyfloyd/go-errorlint#fmterrorf-wrapping-verb exhaustive: - default-signifies-exhaustive: false - funlen: - lines: 60 - statements: 40 + default-signifies-exhaustive: true gci: local-prefixes: %[1]s - gocognit: - min-complexity: 30 - nestif: - min-complexity: 5 - goconst: - min-len: 3 - min-occurrences: 3 gocritic: disabled-checks: [] gocyclo: min-complexity: 20 godot: - check-all: false + scope: all # FIXME `declarations`, `toplevel`, or `all` + capital: true # FIXME godox: - keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting - - NOTE + keywords: - OPTIMIZE # marks code that should be optimized before merging - HACK # marks hack-arounds that should be removed before merging - gofmt: - simplify: true + gofumpt: + lang-version: "%[2]s" + goheader: + template: | + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. goimports: local-prefixes: %[1]s - golint: - min-confidence: 0.8 - gomnd: - settings: {} gomodguard: {} + gosimple: + go: "%[2]s" + checks: ["all"] govet: check-shadowing: true enable-all: true @@ -72,41 +63,32 @@ linters-settings: misspell: locale: US ignore-words: [] - nakedret: - max-func-lines: 30 - prealloc: - simple: true - range-loops: true # Report preallocation suggestions on range loops, true by default - for-loops: false # Report preallocation suggestions on for loops, false by default nolintlint: allow-unused: false allow-leading-space: false allow-no-explanation: [] - require-explanation: false + require-explanation: true require-specific: true - rowserrcheck: {} - testpackage: + staticcheck: + go: "%[2]s" + checks: ["all"] + stylecheck: + go: "%[2]s" unparam: check-exported: false unused: - check-exported: false - whitespace: - multi-if: false # Enforces newlines (or comments) after every multi-line if statement - multi-func: false # Enforces newlines (or comments) after every multi-line function signature + go: "%[2]s" wsl: - strict-append: true + allow-assign-and-anything: false allow-assign-and-call: true - allow-multiline-assign: true allow-cuddle-declarations: false + allow-multiline-assign: true + allow-separated-leading-comment: false allow-trailing-comment: false force-case-trailing-whitespace: 0 force-err-cuddling: false - allow-separated-leading-comment: false - gofumpt: - extra-rules: false - cyclop: - # the maximal code complexity to report - max-complexity: 20 + force-short-decl-cuddling: false + strict-append: true linters: enable-all: true @@ -121,10 +103,16 @@ linters: - gochecknoinits - godox - goerr113 + - golint # deprecated, replaced by revive - gomnd + - ifshort # https://github.com/esimonov/ifshort/issues/7 + - interfacer # deprecated due to bad suggestions + - maligned # deprecated, replaced by govet's fieldalignment - nestif - paralleltest - - tagliatelle + - scopelint # deprecated, replaced by exportloopref + - tagliatelle # until https://github.com/ldez/tagliatelle/issues/2 is implemented in golangci-lint + - thelper - typecheck - wrapcheck