diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0d9f9ff935aa..eb092d6dafdd 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -74,7 +74,7 @@ jobs: uses: actions/setup-go@v2 with: go-version: ${{ matrix.golang }} - - uses: actions/cache@v2.1.6 + - uses: actions/cache@v2.1.7 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }} diff --git a/.golangci.example.yml b/.golangci.example.yml index 55a413860456..0e17ee939807 100644 --- a/.golangci.example.yml +++ b/.golangci.example.yml @@ -1,49 +1,53 @@ # This file contains all available configuration options -# with their default values. +# with their default values (in comments). -# options for analysis running +# Options for analysis running. run: - # default concurrency is a available CPU number + # The default concurrency value is the number of available CPU. concurrency: 4 - # timeout for analysis, e.g. 30s, 5m, default is 1m - timeout: 1m + # Timeout for analysis, e.g. 30s, 5m. + # Default: 1m + timeout: 5m - # exit code when at least one issue was found, default is 1 - issues-exit-code: 1 + # Exit code when at least one issue was found. + # Default: 1 + issues-exit-code: 2 - # include test files or not, default is true - tests: true + # Include test files or not. + # Default: true + tests: false - # list of build tags, all linters use it. Default is empty list. + # List of build tags, all linters use it. + # Default: []. build-tags: - mytag - # which dirs to skip: issues from them won't be reported; - # can use regexp here: generated.*, regexp is applied on full path; - # default value is empty list, but default dirs are skipped independently - # from this option's value (see skip-dirs-use-default). - # "/" will be replaced by current OS file path separator to properly work - # on Windows. + # Which dirs to skip: issues from them won't be reported. + # Can use regexp here: `generated.*`, regexp is applied on full path. + # Default value is empty list, + # but default dirs are skipped independently of this option's value (see skip-dirs-use-default). + # "/" will be replaced by current OS file path separator to properly work on Windows. skip-dirs: - src/external_libs - autogenerated_by_my_lib - # default is true. Enables skipping of directories: - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs-use-default: true - - # which files to skip: they will be analyzed, but issues from them - # won't be reported. Default value is empty list, but there is - # no need to include all autogenerated files, we confidently recognize - # autogenerated files. If it's not please let us know. - # "/" will be replaced by current OS file path separator to properly work - # on Windows. + # Enables skipping of directories: + # - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ + # Default: true + skip-dirs-use-default: false + + # Which files to skip: they will be analyzed, but issues from them won't be reported. + # Default value is empty list, + # but there is no need to include all autogenerated files, + # we confidently recognize autogenerated files. + # If it's not please let us know. + # "/" will be replaced by current OS file path separator to properly work on Windows. skip-files: - ".*\\.my\\.go$" - lib/bad.go - # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": + # If set we pass it to "go list -mod={option}". From "go help modules": # If invoked with -mod=readonly, the go command is disallowed from the implicit # automatic updating of go.mod described above. Instead, it fails when any changes # to go.mod are needed. This setting is most useful to check that go.mod does @@ -51,7 +55,10 @@ run: # If invoked with -mod=vendor, the go command assumes that the vendor # directory holds the correct copies of dependencies and ignores # the dependency descriptions in go.mod. - modules-download-mode: readonly|vendor|mod + # + # Allowed values: readonly|vendor|mod + # By default, it isn't set. + modules-download-mode: readonly # Allow multiple parallel golangci-lint instances running. # If false (default) - golangci-lint acquires file lock on start. @@ -60,184 +67,337 @@ run: # output configuration options output: - # colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions - # default is "colored-line-number" - format: colored-line-number - - # print lines of code with issue, default is true - print-issued-lines: true - - # print linter name in the end of issue text, default is true - print-linter-name: true - - # make issues output unique by line, default is true - uniq-by-line: true - - # add a prefix to the output file references; default is no prefix + # Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions + # + # Multiple can be specified by separating them by comma, output can be provided + # for each of them by separating format name and path by colon symbol. + # Output path can be either `stdout`, `stderr` or path to the file to write to. + # Example: "checkstyle:report.json,colored-line-number" + # + # Default: colored-line-number + format: json + + # Print lines of code with issue. + # Default: true + print-issued-lines: false + + # Print linter name in the end of issue text. + # Default: true + print-linter-name: false + + # Make issues output unique by line. + # Default: true + uniq-by-line: false + + # Add a prefix to the output file references. + # Default is no prefix. path-prefix: "" - # sorts results by: filepath, line and column + # Sort results by: filepath, line and column. sort-results: false -# all available settings of specific linters +# All available settings of specific linters. linters-settings: + bidichk: + # The following configurations check for all mentioned invisible unicode runes. + # All runes are enabled by default. + left-to-right-embedding: false + right-to-left-embedding: false + pop-directional-formatting: false + left-to-right-override: false + right-to-left-override: false + left-to-right-isolate: false + right-to-left-isolate: false + first-strong-isolate: false + pop-directional-isolate: false cyclop: - # the maximal code complexity to report + # The maximal code complexity to report. max-complexity: 10 - # the maximal average package complexity. If it's higher than 0.0 (float) the check is enabled (default 0.0) - package-average: 0.0 - # should ignore tests (default false) - skip-tests: false + # The maximal average package complexity. + # If it's higher than 0.0 (float) the check is enabled + # Default: 0.0 + package-average: 0.5 + # Should ignore tests. + # Default: false + skip-tests: true + + decorder: + # Required order of `type`, `const`, `var` and `func` declarations inside a file. + # Default: types before constants before variables before functions. + dec-order: + - type + - const + - var + - func + + # If true, order of declarations is not checked at all. + # Default: true (disabled) + disable-dec-order-check: false + + # If true, `init` func can be anywhere in file (must not be declared before all other functions). + # Default: true (disabled) + disable-init-func-first-check: false + + # If true, multiple global `type`, `const` and `var` declarations are allowed. + # Default: true (disabled) + disable-dec-num-check: false + + depguard: + # Kind of list is passed in. + # Allowed values: allowlist|denylist + # Default: denylist + list-type: allowlist + + # Check the list against standard lib. + # Default: false + include-go-root: true + + # A list of packages for the list type specified. + # Default: [] + packages: + - github.com/sirupsen/logrus + + # A list of packages for the list type specified. + # Specify an error message to output when a denied package is used. + # Default: [] + packages-with-error-message: + - github.com/sirupsen/logrus: 'logging is allowed only by logutils.Log' + + # Create additional guards that follow the same configuration pattern. + # Results from all guards are aggregated together. + additional-guards: + - list-type: denylist + include-go-root: false + packages: + - github.com/stretchr/testify + # Specify rules by which the linter ignores certain files for consideration. + ignore-file-rules: + - "**/*_test.go" + - "**/mock/**/*.go" dogsled: - # checks assignments with too many blank identifiers; default is 2 - max-blank-identifiers: 2 + # Checks assignments with too many blank identifiers. + # Default: 2 + max-blank-identifiers: 3 dupl: - # tokens count to trigger issue, 150 by default + # Tokens count to trigger issue. + # Default: 150 threshold: 100 errcheck: - # report about not checking of errors in type assertions: `a := b.(MyStruct)`; - # default is false: such cases aren't reported by default. - check-type-assertions: false - - # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; - # default is false: such cases aren't reported by default. - check-blank: false - - # [deprecated] comma-separated list of pairs of the form pkg:regex + # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. + # Such cases aren't reported by default. + # Default: false + check-type-assertions: true + + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`. + # Such cases aren't reported by default. + # Default: false + check-blank: true + + # DEPRECATED comma-separated list of pairs of the form pkg:regex + # # the regex is used to ignore names within pkg. (default "fmt:.*"). # see https://github.com/kisielk/errcheck#the-deprecated-method for details ignore: fmt:.*,io/ioutil:^Read.* - # [deprecated] use exclude-functions instead. - # path to a file containing a list of functions to exclude from checking - # see https://github.com/kisielk/errcheck#excluding-functions for details + # DEPRECATED use exclude-functions instead. + # + # Path to a file containing a list of functions to exclude from checking. + # See https://github.com/kisielk/errcheck#excluding-functions for details. exclude: /path/to/file.txt - # list of functions to exclude from checking, where each entry is a single function to exclude. - # see https://github.com/kisielk/errcheck#excluding-functions for details + # List of functions to exclude from checking, where each entry is a single function to exclude. + # See https://github.com/kisielk/errcheck#excluding-functions for details. exclude-functions: - io/ioutil.ReadFile - io.Copy(*bytes.Buffer) - io.Copy(os.Stdout) + errchkjson: + # With check-error-free-encoding set to true, errchkjson does warn about errors + # from json encoding functions that are safe to be ignored, + # because they are not possible to happen. + # + # if check-error-free-encoding is set to true and errcheck linter is enabled, + # it is recommended to add the following exceptions to prevent from false positives: + # + # linters-settings: + # errcheck: + # exclude-functions: + # - encoding/json.Marshal + # - encoding/json.MarshalIndent + # + # Default: false + check-error-free-encoding: true + + # Issue on struct encoding that doesn't have exported fields. + # Default: false + report-no-exported: false + errorlint: - # Check whether fmt.Errorf uses the %w verb for formatting errors. See the readme for caveats - errorf: true - # Check for plain type assertions and type switches - asserts: true - # Check for plain error comparisons - comparison: true + # Check whether fmt.Errorf uses the %w verb for formatting errors. + # See the https://github.com/polyfloyd/go-errorlint for caveats. + # Default: true + errorf: false + # Check for plain type assertions and type switches. + # Default: true + asserts: false + # Check for plain error comparisons. + # Default: true + comparison: false exhaustive: - # check switch statements in generated files also - check-generated: false - # indicates that switch statements are to be considered exhaustive if a - # 'default' case is present, even if all enum members aren't listed in the - # switch - default-signifies-exhaustive: false + # Check switch statements in generated files also. + # Default: false + check-generated: true + # Presence of "default" case in switch statements satisfies exhaustiveness, + # even if all enum members are not listed. + # Default: false + default-signifies-exhaustive: true + # Enum members matching the supplied regex do not have to be listed in + # switch statements to satisfy exhaustiveness. + # Default: "" + ignore-enum-members: "Example.+" + # Consider enums only in package scopes, not in inner scopes. + # Default: false + package-scope-only: true exhaustivestruct: - # Struct Patterns is list of expressions to match struct packages and names - # The struct packages have the form example.com/package.ExampleStruct - # The matching patterns can use matching syntax from https://pkg.go.dev/path#Match + # Struct Patterns is list of expressions to match struct packages and names. + # The struct packages have the form `example.com/package.ExampleStruct`. + # The matching patterns can use matching syntax from https://pkg.go.dev/path#Match. # If this list is empty, all structs are tested. struct-patterns: - '*.Test' - 'example.com/package.ExampleStruct' forbidigo: - # Forbid the following identifiers (identifiers are written using regexp): + # Forbid the following identifiers (list of regexp). forbid: - ^print.*$ - 'fmt\.Print.*' - # Exclude godoc examples from forbidigo checks. Default is true. + # Exclude godoc examples from forbidigo checks. + # Default: true exclude_godoc_examples: false funlen: - lines: 60 - statements: 40 + # Checks the number of lines in a function. + # If lower than 0, disable the check. + # Default: 60 + lines: -1 + # Checks the number of statements in a function. + # If lower than 0, disable the check. + # Default: 40 + statements: -1 gci: - # put imports beginning with prefix after 3rd-party packages; - # only support one prefix - # if not set, use goimports.local-prefixes + # Put imports beginning with prefix after 3rd-party packages. + # Only support one prefix. + # If not set, use `goimports.local-prefixes`. local-prefixes: github.com/org/project gocognit: - # minimal code complexity to report, 30 by default (but we recommend 10-20) + # Minimal code complexity to report + # Default: 30 (but we recommend 10-20) min-complexity: 10 goconst: - # minimal length of string constant, 3 by default - min-len: 3 - # minimum occurrences of constant string count to trigger issue, 3 by default - min-occurrences: 3 - # ignore test files, false by default - ignore-tests: false - # look for existing constants matching the values, true by default - match-constant: true - # search also for duplicated numbers, false by default - numbers: false - # minimum value, only works with goconst.numbers, 3 by default - min: 3 - # maximum value, only works with goconst.numbers, 3 by default - max: 3 - # ignore when constant is not used as function argument, true by default - ignore-calls: true + # Minimal length of string constant. + # Default: 3 + min-len: 2 + # Minimum occurrences of constant string count to trigger issue. + # Default: 3 + min-occurrences: 2 + # Ignore test files. + # Default: false + ignore-tests: true + # Look for existing constants matching the values. + # Default: true + match-constant: false + # Search also for duplicated numbers. + # Default: false + numbers: true + # Minimum value, only works with goconst.numbers + # Default: 3 + min: 2 + # Maximum value, only works with goconst.numbers + # Default: 3 + max: 2 + # Ignore when constant is not used as function argument. + # Default: true + ignore-calls: false gocritic: - # Which checks should be enabled; can't be combined with 'disabled-checks'; - # See https://go-critic.github.io/overview#checks-overview - # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` - # By default list of stable checks is used. + # Which checks should be enabled; can't be combined with 'disabled-checks'. + # See https://go-critic.github.io/overview#checks-overview. + # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`. + # By default, list of stable checks is used. enabled-checks: - nestingReduce - - unnamedresult + - unnamedResult - ruleguard - truncateCmp - # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty + # Which checks should be disabled; can't be combined with 'enabled-checks'. + # Default: [] disabled-checks: - regexpMust # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. - # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". + # See https://github.com/go-critic/go-critic#usage -> section "Tags". + # Default: [] enabled-tags: + - diagnostic + - style - performance + - experimental + - opinionated disabled-tags: + - diagnostic + - style + - performance - experimental + - opinionated # Settings passed to gocritic. # The settings key is the name of a supported gocritic checker. # The list of supported checkers can be find in https://go-critic.github.io/overview. settings: - captLocal: # must be valid enabled check name - # whether to restrict checker to params only (default true) - paramsOnly: true + # Must be valid enabled check name. + captLocal: + # Whether to restrict checker to params only. + # Default: true + paramsOnly: false elseif: - # whether to skip balanced if-else pairs (default true) - skipBalanced: true + # Whether to skip balanced if-else pairs. + # Default: true + skipBalanced: false hugeParam: - # size in bytes that makes the warning trigger (default 80) - sizeThreshold: 80 + # Size in bytes that makes the warning trigger. + # Default: 80 + sizeThreshold: 70 nestingReduce: - # min number of statements inside a branch to trigger a warning (default 5) - bodyWidth: 5 + # Min number of statements inside a branch to trigger a warning. + # Default: 5 + bodyWidth: 4 rangeExprCopy: - # size in bytes that makes the warning trigger (default 512) - sizeThreshold: 512 - # whether to check test functions (default true) - skipTestFuncs: true + # Size in bytes that makes the warning trigger. + # Default: 512 + sizeThreshold: 516 + # Whether to check test functions + # Default: true + skipTestFuncs: false rangeValCopy: - # size in bytes that makes the warning trigger (default 128) + # Size in bytes that makes the warning trigger. + # Default: 128 sizeThreshold: 32 - # whether to check test functions (default true) - skipTestFuncs: true + # Whether to check test functions. + # Default: true + skipTestFuncs: false ruleguard: # Enable debug to identify which 'Where' condition was rejected. # The value of the parameter is the name of a function in a ruleguard file. @@ -267,62 +427,81 @@ linters-settings: # Glob patterns such as 'rules-*.go' may be specified. rules: '${configDir}/ruleguard/rules-*.go,${configDir}/myrule1.go' tooManyResultsChecker: - # maximum number of results (default 5) + # Maximum number of results. + # Default: 5 maxResults: 10 truncateCmp: - # whether to skip int/uint/uintptr types (default true) - skipArchDependent: true + # Whether to skip int/uint/uintptr types. + # Default: true + skipArchDependent: false underef: - # whether to skip (*x).method() calls where x is a pointer receiver (default true) - skipRecvDeref: true + # Whether to skip (*x).method() calls where x is a pointer receiver. + # Default: true + skipRecvDeref: false unnamedResult: - # whether to check exported functions + # Whether to check exported functions. checkExported: true gocyclo: - # minimal code complexity to report, 30 by default (but we recommend 10-20) + # Minimal code complexity to report. + # Default: 30 (but we recommend 10-20) min-complexity: 10 godot: - # comments to be checked: `declarations`, `toplevel`, or `all` - scope: declarations - # list of regexps for excluding particular comment lines from check + # Comments to be checked: `declarations`, `toplevel`, or `all`. + # Default: declarations + scope: toplevel + # List of regexps for excluding particular comment lines from check. exclude: - # example: exclude comments which contain numbers - # - '[0-9]+' - # check that each sentence starts with a capital letter - capital: false + # Exclude todo and fixme comments. + - "^fixme:" + - "^todo:" + # Check that each sentence ends with a period. + # Default: true + period: false + # Check that each sentence starts with a capital letter. + # Default: false + capital: true godox: - # report any comments starting with keywords, this is useful for TODO or FIXME comments that - # might be left in the code accidentally and should be resolved before merging - keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting + # Report any comments starting with keywords, this is useful for TODO or FIXME comments that + # might be left in the code accidentally and should be resolved before merging. + # Default: TODO, BUG, and FIXME. + keywords: - NOTE - OPTIMIZE # marks code that should be optimized before merging - - HACK # marks hack-arounds that should be removed before merging + - HACK # marks hack-around that should be removed before merging gofmt: - # simplify code: gofmt with `-s` option, true by default - simplify: true + # Simplify code: gofmt with `-s` option. + # Default: true + simplify: false gofumpt: - # Select the Go version to target. The default is `1.15`. - lang-version: "1.15" + # Select the Go version to target. + # Default: 1.15 + lang-version: "1.17" - # Choose whether or not to use the extra rules that are disabled - # by default - extra-rules: false + # Choose whether to use the extra rules. + # Default: false + extra-rules: true goheader: + # Supports two types 'const` and `regexp`. + # Values can be used recursively. values: const: - # define here const type values in format k:v, for example: - # COMPANY: MY COMPANY + # Define here const type values in format k:v. + # For example: + COMPANY: MY COMPANY regexp: - # define here regexp type values, for example - # AUTHOR: .*@mycompany\.com - template: # |- - # put here copyright header template for source code files, for example: + # Define here regexp type values. + # for example: + AUTHOR: .*@mycompany\.com + # The template use for checking. + template: |- + # Put here copyright header template for source code files + # For example: # Note: {{ YEAR }} is a builtin value that returns the year relative to the current machine time. # # {{ AUTHOR }} {{ COMPANY }} {{ YEAR }} @@ -339,73 +518,179 @@ linters-settings: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - template-path: - # also as alternative of directive 'template' you may put the path to file with the template source + # As alternative of directive 'template', you may put the path to file with the template source. + # Useful if you need to load the template from a specific file. + template-path: /path/to/my/template.tmpl goimports: - # put imports beginning with prefix after 3rd-party packages; - # it's a comma-separated list of prefixes + # Put imports beginning with prefix after 3rd-party packages. + # It's a comma-separated list of prefixes. local-prefixes: github.com/org/project golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0.8 + # Minimal confidence for issues. + # Default: 0.8 + min-confidence: 0.7 gomnd: - settings: - mnd: - # the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. - checks: argument,case,condition,operation,return,assign - # ignored-numbers: 1000 - # ignored-files: magic_.*.go - # ignored-functions: math.* + # List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. + checks: + - argument + - case + - condition + - operation + - return + - assign + # List of numbers to exclude from analysis. + # The numbers should be written as string. + # Values always ignored: "1", "1.0", "0" and "0.0" + ignored-numbers: + - '0666' + - '0755' + - '42' + # List of file patterns to exclude from analysis. + # Values always ignored: `.+_test.go` + ignored-files: + - 'magic1_.*.go' + # List of function patterns to exclude from analysis. + # Values always ignored: `time.Time` + ignored-functions: + - 'math.*' + - 'http.StatusText' gomoddirectives: - # Allow local `replace` directives. Default is false. + # Allow local `replace` directives. replace-local: false - # List of allowed `replace` directives. Default is empty. + # List of allowed `replace` directives. + # Default: [] replace-allow-list: - launchpad.net/gocheck - # Allow to not explain why the version has been retracted in the `retract` directives. Default is false. + # Allow to not explain why the version has been retracted in the `retract` directives. + # Default: false retract-allow-no-explanation: false - # Forbid the use of the `exclude` directives. Default is false. + # Forbid the use of the `exclude` directives. + # Default: false exclude-forbidden: false gomodguard: allowed: - modules: # List of allowed modules - # - gopkg.in/yaml.v2 - domains: # List of allowed module domains - # - golang.org + # List of allowed modules. + modules: + - gopkg.in/yaml.v2 + # List of allowed module domains. + domains: + - golang.org blocked: - modules: # List of blocked modules - # - github.com/uudashr/go-module: # Blocked module - # recommendations: # Recommended modules that should be used instead (Optional) - # - golang.org/x/mod - # reason: "`mod` is the official go.mod parser library." # Reason why the recommended module should be used (Optional) - versions: # List of blocked module version constraints - # - github.com/mitchellh/go-homedir: # Blocked module with version constraint - # version: "< 1.1.0" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons - # reason: "testing if blocked version constraint works." # Reason why the version constraint exists. (Optional) - local_replace_directives: false # Set to true to raise lint issues for packages that are loaded from a local path via replace directive + # List of blocked modules. + modules: + # Blocked module. + - github.com/uudashr/go-module: + # Recommended modules that should be used instead. (Optional) + recommendations: + - golang.org/x/mod + # Reason why the recommended module should be used. (Optional) + reason: "`mod` is the official go.mod parser library." + # List of blocked module version constraints. + versions: + # Blocked module with version constraint. + - github.com/mitchellh/go-homedir: + # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons. + version: "< 1.1.0" + # Reason why the version constraint exists. (Optional) + reason: "testing if blocked version constraint works." + # Set to true to raise lint issues for packages that are loaded from a local path via replace directive. + local_replace_directives: false + + gosimple: + # Select the Go version to target. + # Default: 1.13 + go: "1.15" + # https://staticcheck.io/docs/options#checks + checks: [ "all" ] gosec: # To select a subset of rules to run. # Available rules: https://github.com/securego/gosec#available-rules includes: - - G401 - - G306 - G101 + - G102 + - G103 + - G104 + - G106 + - G107 + - G108 + - G109 + - G110 + - G201 + - G202 + - G203 + - G204 + - G301 + - G302 + - G303 + - G304 + - G305 + - G306 + - G307 + - G401 + - G402 + - G403 + - G404 + - G501 + - G502 + - G503 + - G504 + - G505 + - G601 + # To specify a set of rules to explicitly exclude. # Available rules: https://github.com/securego/gosec#available-rules excludes: + - G101 + - G102 + - G103 + - G104 + - G106 + - G107 + - G108 + - G109 + - G110 + - G201 + - G202 + - G203 - G204 + - G301 + - G302 + - G303 + - G304 + - G305 + - G306 + - G307 + - G401 + - G402 + - G403 + - G404 + - G501 + - G502 + - G503 + - G504 + - G505 + - G601 + # Exclude generated files + # Default: false exclude-generated: true - # Filter out the issues with a lower severity than the given value. Valid options are: low, medium, high. - severity: "low" - # Filter out the issues with a lower confidence than the given value. Valid options are: low, medium, high. - confidence: "low" + + # Filter out the issues with a lower severity than the given value. + # Valid options are: low, medium, high. + # Default: low + severity: medium + + # Filter out the issues with a lower confidence than the given value. + # Valid options are: low, medium, high. + # Default: low + confidence: medium + # To specify the configuration of rules. # The configuration of rules is not fully documented by gosec: # https://github.com/securego/gosec#configuration @@ -419,59 +704,159 @@ linters-settings: per_char_threshold: "3.0" truncate: "32" - gosimple: - # Select the Go version to target. The default is '1.13'. - go: "1.15" - # https://staticcheck.io/docs/options#checks - checks: [ "all" ] - govet: - # report about shadowed variables + # Report about shadowed variables. + # Default: false check-shadowing: true - # settings per analyzer + # Settings per analyzer. settings: - printf: # analyzer name, run `go tool vet help` to see all analyzers - funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer + # Analyzer name, run `go tool vet help` to see all analyzers. + printf: + # Run `go tool vet help printf` to see available settings for `printf` analyzer. + funcs: - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - # enable or disable analyzers by name - # run `go tool vet help` to see all analyzers + # Disable all analyzers. + # Default: false + disable-all: true + # Enable analyzers by name. + # Run `go tool vet help` to see all analyzers. enable: + - asmdecl + - assign + - atomic - atomicalign - enable-all: false + - bools + - buildtag + - cgocall + - composites + - copylocks + - deepequalerrors + - errorsas + - fieldalignment + - findcall + - framepointer + - httpresponse + - ifaceassert + - loopclosure + - lostcancel + - nilfunc + - nilness + - printf + - reflectvaluecompare + - shadow + - shift + - sigchanyzer + - sortslice + - stdmethods + - stringintconv + - structtag + - testinggoroutine + - tests + - unmarshal + - unreachable + - unsafeptr + - unusedresult + - unusedwrite + + # Enable all analyzers. + # Default: false + enable-all: true + # Disable analyzers by name. + # Run `go tool vet help` to see all analyzers. disable: + - asmdecl + - assign + - atomic + - atomicalign + - bools + - buildtag + - cgocall + - composites + - copylocks + - deepequalerrors + - errorsas + - fieldalignment + - findcall + - framepointer + - httpresponse + - ifaceassert + - loopclosure + - lostcancel + - nilfunc + - nilness + - printf + - reflectvaluecompare - shadow - disable-all: false - - depguard: - list-type: blacklist - include-go-root: false - packages: - - github.com/sirupsen/logrus - packages-with-error-message: - # specify an error message to output when a blacklisted package is used - - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" + - shift + - sigchanyzer + - sortslice + - stdmethods + - stringintconv + - structtag + - testinggoroutine + - tests + - unmarshal + - unreachable + - unsafeptr + - unusedresult + - unusedwrite + + grouper: + # Require the use of a single global 'const' declaration only. + # Default: false + const-require-single-const: true + # Require the use of grouped global 'const' declarations. + # Default: false + const-require-grouping: true + + # Require the use of a single 'import' declaration only. + # Default: false + import-require-single-import: true + # Require the use of grouped 'import' declarations. + # Default: false + import-require-grouping: true + + # Require the use of a single global 'type' declaration only. + # Default: false + type-require-single-type: true + # Require the use of grouped global 'type' declarations. + # Default: false + type-require-grouping: true + + # Require the use of a single global 'var' declaration only. + # Default: false + var-require-single-var: true + # Require the use of grouped global 'var' declarations. + # Default: false + var-require-grouping: true ifshort: # Maximum length of variable declaration measured in number of lines, after which linter won't suggest using short syntax. # Has higher priority than max-decl-chars. - max-decl-lines: 1 + # Default: 1 + max-decl-lines: 2 # Maximum length of variable declaration measured in number of characters, after which linter won't suggest using short syntax. - max-decl-chars: 30 + # Default: 30 + max-decl-chars: 40 importas: - # if set to `true`, force to use alias. + # Do not allow unaliased imports of aliased packages. + # Default: false no-unaliased: true + # Do not allow non-required aliases. + # Default: false + no-extra-aliases: true # List of aliases alias: - # using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package + # Using `servingv1` alias for `knative.dev/serving/pkg/apis/serving/v1` package. - pkg: knative.dev/serving/pkg/apis/serving/v1 alias: servingv1 - # using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package + # Using `autoscalingv1alpha1` alias for `knative.dev/serving/pkg/apis/autoscaling/v1alpha1` package. - pkg: knative.dev/serving/pkg/apis/autoscaling/v1alpha1 alias: autoscalingv1alpha1 # You can specify the package path by regular expression, @@ -492,50 +877,63 @@ linters-settings: # By default, it allows using errors, empty interfaces, anonymous interfaces, # and interfaces provided by the standard library. allow: - - anon - - error - - empty - - stdlib - # You can specify idiomatic endings for interface - - (or|er)$ - - # Reject patterns + - anon + - error + - empty + - stdlib + # You can specify idiomatic endings for interface + - (or|er)$ + + # reject-list of interfaces reject: - - github.com\/user\/package\/v4\.Type + - github.com\/user\/package\/v4\.Type lll: - # max line length, lines longer will be reported. Default is 120. - # '\t' is counted as 1 character by default, and can be changed with the tab-width option + # Max line length, lines longer will be reported. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option. + # Default: 120. line-length: 120 - # tab width in spaces. Default to 1. + # Tab width in spaces. + # Default: 1 tab-width: 1 + maintidx: + # Show functions with maintainability index lower than N. + # A high index indicates better maintainability (it's kind of the opposite of complexity). + # Default: 20 + under: 100 + makezero: - # Allow only slices initialized with a length of zero. Default is false. + # Allow only slices initialized with a length of zero. + # Default: false always: false maligned: - # print struct with more effective memory layout or not, false by default + # Print struct with more effective memory layout or not. + # Default: false suggest-new: true misspell: # Correct spellings using locale preferences for US or UK. - # Default is to use a neutral variety of English. # Setting locale to US will correct the British spelling of 'colour' to 'color'. + # Default is to use a neutral variety of English. locale: US ignore-words: - someword nakedret: - # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 - max-func-lines: 30 + # Make an issue if func has more lines of code than this setting, and it has naked returns. + # Default: 30 + max-func-lines: 31 nestif: - # minimal complexity of if statements to report, 5 by default + # Minimal complexity of if statements to report. + # Default: 5 min-complexity: 4 nilnil: - # By default, nilnil checks all returned types below. + # Checks that there is no simultaneous return of `nil` error and an invalid value. + # Default: ptr, func, iface, map, chan checked-types: - ptr - func @@ -544,80 +942,396 @@ linters-settings: - chan nlreturn: - # size of the block (including return statement that is still "OK") + # Size of the block (including return statement that is still "OK") # so no return split required. - block-size: 1 + # Default: 1 + block-size: 2 nolintlint: - # Disable to ensure that all nolint directives actually have an effect. Default is true. - allow-unused: false - # Disable to ensure that nolint directives don't have a leading space. Default is true. - allow-leading-space: true - # Exclude following linters from requiring an explanation. Default is []. + # Disable to ensure that all nolint directives actually have an effect. + # Default: false + allow-unused: true + # Disable to ensure that nolint directives don't have a leading space. + # Default: true + allow-leading-space: false + # Exclude following linters from requiring an explanation. + # Default: [] allow-no-explanation: [ ] - # Enable to require an explanation of nonzero length after each nolint directive. Default is false. + # Enable to require an explanation of nonzero length after each nolint directive. + # Default: false require-explanation: true - # Enable to require nolint directives to mention the specific linter being suppressed. Default is false. + # Enable to require nolint directives to mention the specific linter being suppressed. + # Default: false require-specific: true prealloc: - # XXX: we don't recommend using this linter before doing performance profiling. + # IMPORTANT: we don't recommend using this linter before doing performance profiling. # For most programs usage of prealloc will be a premature optimization. - # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. - # True by default. - 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 + # Report pre-allocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. + # Default: true + simple: false + # Report pre-allocation suggestions on range loops. + # Default: true + range-loops: false + # Report pre-allocation suggestions on for loops. + # Default: false + for-loops: true + + predeclared: + # Comma-separated list of predeclared identifiers to not report on. + # Default: "" + ignore: "new,int" + # Include method names and field names (i.e., qualified names) in checks. + # Default: false + q: true promlinter: # Promlinter cannot infer all metrics name in static analysis. # Enable strict mode will also include the errors caused by failing to parse the args. - strict: false + # Default: false + strict: true # Please refer to https://github.com/yeya24/promlinter#usage for detailed usage. disabled-linters: - # - "Help" - # - "MetricUnits" - # - "Counter" - # - "HistogramSummaryReserved" - # - "MetricTypeInName" - # - "ReservedChars" - # - "CamelCase" - # - "lintUnitAbbreviations" - - predeclared: - # comma-separated list of predeclared identifiers to not report on - ignore: "" - # include method names and field names (i.e., qualified names) in checks - q: false - - rowserrcheck: - packages: - - github.com/jmoiron/sqlx + - Help + - MetricUnits + - Counter + - HistogramSummaryReserved + - MetricTypeInName + - ReservedChars + - CamelCase + - UnitAbbreviations revive: - # see https://github.com/mgechev/revive#available-rules for details. + # See https://github.com/mgechev/revive#available-rules for details. ignore-generated-header: true severity: warning + enable-all-rules: false + # confidence: 0.8 + # error-code: 0 + # warning-code: 0 rules: - - name: indent-error-flow - severity: warning + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#add-constant - name: add-constant severity: warning + disabled: false arguments: - maxLitCount: "3" allowStrs: '""' allowInts: "0,1,2" allowFloats: "0.0,0.,1.0,1.,2.0,2." + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#atomic + - name: atomic + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#banned-characters + - name: banned-characters + severity: warning + disabled: false + arguments: ["Ω","Σ","σ", "7"] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bare-return + - name: bare-return + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#blank-imports + - name: blank-imports + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr + - name: bool-literal-in-expr + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#call-to-gc + - name: call-to-gc + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cognitive-complexity + - name: cognitive-complexity + severity: warning + disabled: false + arguments: [ 7 ] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-naming + - name: confusing-naming + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-results + - name: confusing-results + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#constant-logical-expr + - name: constant-logical-expr + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument + - name: context-as-argument + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type + - name: context-keys-type + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cyclomatic + - name: cyclomatic + severity: warning + disabled: false + arguments: [ 3 ] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#deep-exit + - name: deep-exit + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#defer + - name: defer + severity: warning + disabled: false + arguments: + - [ "call-chain", "loop" ] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports + - name: dot-imports + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports + - name: duplicated-imports + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return + - name: early-return + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block + - name: empty-block + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines + - name: empty-lines + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming + - name: error-naming + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-return + - name: error-return + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-strings + - name: error-strings + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#errorf + - name: errorf + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported + - name: exported + severity: warning + disabled: false + arguments: + - "checkPrivateReceivers" + - "sayRepetitiveInsteadOfStutters" + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#file-header + - name: file-header + severity: warning + disabled: false + arguments: + - This is the text that must appear at the top of source files. + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter + - name: flag-parameter + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#function-result-limit + - name: function-result-limit + severity: warning + disabled: false + arguments: [ 2 ] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#function-length + - name: function-length + severity: warning + disabled: false + arguments: [ 10, 0 ] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#get-return + - name: get-return + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#identical-branches + - name: identical-branches + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#if-return + - name: if-return + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#increment-decrement + - name: increment-decrement + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#indent-error-flow + - name: indent-error-flow + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#imports-blacklist + - name: imports-blacklist + severity: warning + disabled: false + arguments: + - "crypto/md5" + - "crypto/sha1" + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-shadowing + - name: import-shadowing + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#line-length-limit + - name: line-length-limit + severity: warning + disabled: false + arguments: [ 80 ] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#max-public-structs + - name: max-public-structs + severity: warning + disabled: false + arguments: [ 3 ] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-parameter + - name: modifies-parameter + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#modifies-value-receiver + - name: modifies-value-receiver + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#nested-structs + - name: nested-structs + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#optimize-operands-order + - name: optimize-operands-order + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments + - name: package-comments + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range + - name: range + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-in-closure + - name: range-val-in-closure + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-address + - name: range-val-address + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#receiver-naming + - name: receiver-naming + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redefines-builtin-id + - name: redefines-builtin-id + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-of-int + - name: string-of-int + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format + - name: string-format + severity: warning + disabled: false + arguments: + - - 'core.WriteError[1].Message' + - '/^([^A-Z]|$)/' + - must not start with a capital letter + - - 'fmt.Errorf[0]' + - '/(^|[^\.!?])$/' + - must not end in punctuation + - - panic + - '/^[^\n]*$/' + - must not contain line breaks + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag + - name: struct-tag + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#superfluous-else + - name: superfluous-else + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-equal + - name: time-equal + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-naming + - name: time-naming + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming + - name: var-naming + severity: warning + disabled: false + arguments: + - [ "ID" ] # AllowList + - [ "VM" ] # DenyList + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-declaration + - name: var-declaration + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unconditional-recursion + - name: unconditional-recursion + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-naming + - name: unexported-naming + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return + - name: unexported-return + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error + - name: unhandled-error + severity: warning + disabled: false + arguments: + - "fmt.Printf" + - "myFunction" + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt + - name: unnecessary-stmt + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unreachable-code + - name: unreachable-code + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter + - name: unused-parameter + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-receiver + - name: unused-receiver + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break + - name: useless-break + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value + - name: waitgroup-by-value + severity: warning + disabled: false + + rowserrcheck: + packages: + - github.com/jmoiron/sqlx staticcheck: - # Select the Go version to target. The default is '1.13'. + # Select the Go version to target. + # Default: 1.13 go: "1.15" # https://staticcheck.io/docs/options#checks checks: [ "all" ] stylecheck: - # Select the Go version to target. The default is '1.13'. + # Select the Go version to target. + # Default: 1.13 go: "1.15" # https://staticcheck.io/docs/options#checks checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ] @@ -630,13 +1344,14 @@ linters-settings: http-status-code-whitelist: [ "200", "400", "404", "500" ] tagliatelle: - # check the struck tag name case + # Check the struck tag name case. case: - # use the struct field name to check the name of the struct tag + # Use the struct field name to check the name of the struct tag. + # Default: false use-field-name: true rules: - # any struct tag type can be used. - # support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower` + # Any struct tag type can be used. + # Support string case: `camel`, `pascal`, `kebab`, `snake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower` json: camel yaml: camel xml: camel @@ -644,60 +1359,94 @@ linters-settings: avro: snake mapstructure: kebab + tenv: + # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures. + # By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked. + all: false + testpackage: # regexp pattern to skip files skip-regexp: (export|internal)_test\.go thelper: - # The following configurations enable all checks. It can be omitted because all checks are enabled by default. - # You can enable only required checks deleting unnecessary checks. + # The following configurations enable all checks. + # All checks are enabled by default. test: - first: true - name: true - begin: true + first: false + name: false + begin: false benchmark: - first: true - name: true - begin: true + first: false + name: false + begin: false tb: - first: true - name: true - begin: true - - tenv: - # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures. - # By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked. - all: false + first: false + name: false + begin: false unparam: - # Inspect exported functions, default is false. Set to true if no external program/library imports your code. + # Inspect exported functions. + # + # Set to true if no external program/library imports your code. # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: # if it's called for subdir of a project it can't find external interfaces. All text editor integrations # with golangci-lint call it on a directory with the changed file. - check-exported: false + # + # Default: false + check-exported: true - unused: - # Select the Go version to target. The default is '1.13'. - go: "1.15" + varcheck: + # Check usage of exported fields and variables. + # Default: false + exported-fields: true varnamelen: - # The longest distance, in source lines, that is being considered a "small scope." (defaults to 5) + # The longest distance, in source lines, that is being considered a "small scope". # Variables used in at most this many lines will be ignored. - max-distance: 5 - # The minimum length of a variable's name that is considered "long." (defaults to 3) + # Default: 5 + max-distance: 6 + # The minimum length of a variable's name that is considered "long". # Variable names that are at least this long will be ignored. - min-name-length: 3 - # Check method receiver names. (defaults to false) - check-receiver: false - # Check named return values. (defaults to false) - check-return: false - # Optional list of variable names that should be ignored completely. (defaults to empty list) + # Default: 3 + min-name-length: 2 + # Check method receiver names. + # Default: false + check-receiver: true + # Check named return values. + # Default: false + check-return: true + # Ignore "ok" variables that hold the bool return value of a type assertion. + # Default: false + ignore-type-assert-ok: true + # Ignore "ok" variables that hold the bool return value of a map index. + # Default: false + ignore-map-index-ok: true + # Ignore "ok" variables that hold the bool return value of a channel receive. + # Default: false + ignore-chan-recv-ok: true + # Optional list of variable names that should be ignored completely. + # Default: [] ignore-names: - err + # Optional list of variable declarations that should be ignored completely. + # Entries must be in the form of " " or " *" + # for variables, or "const " for constants. + # Default: [] + ignore-decls: + - c echo.Context + - t testing.T + - f *foo.Bar + - e error + - i int + - const C 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 + # Enforces newlines (or comments) after every multi-line if statement. + # Default: false + multi-if: true + # Enforces newlines (or comments) after every multi-line function signature. + # Default: false + multi-func: true wrapcheck: # An array of strings that specify substrings of signatures to ignore. @@ -712,57 +1461,291 @@ linters-settings: - .WithMessage( - .WithMessagef( - .WithStack( + ignoreSigRegexps: + - \.New.*Error\( ignorePackageGlobs: - - encoding/* - - github.com/pkg/* + - encoding/* + - github.com/pkg/* wsl: - # See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for - # documentation of available settings. These are the defaults for - # `golangci-lint`. + # See https://github.com/bombsimon/wsl/blob/master/doc/configuration.md for documentation of available settings. + # These are the defaults for `golangci-lint`. + + # Controls if you may cuddle assignments and anything without needing an empty line between them. + # Default: false allow-assign-and-anything: false + + # Controls if you may cuddle assignments and calls without needing an empty line between them. + # Default: true allow-assign-and-call: true + + # Controls if you're allowed to cuddle multiple declarations. + # This is false by default to encourage you to group them in one var block. + # One major benefit with this is that if the variables are assigned the assignments will be tabulated. + # Default: false allow-cuddle-declarations: false + + # Controls if you may cuddle assignments even if they span over multiple lines. + # Default: true allow-multiline-assign: true + + # This option allows whitespace after each comment group that begins a block. + # Default: false allow-separated-leading-comment: false + + # Controls if blocks can end with comments. + # This is not encouraged sine it's usually code smell but might be useful do improve understanding or learning purposes. + # To be allowed there must be no whitespace between the comment and the last statement or the comment and the closing brace. + # Default: false allow-trailing-comment: false + + # Can be set to force trailing newlines at the end of case blocks to improve readability. + # If the number of lines (including comments) in a case block exceeds this number + # a linter error will be yielded if the case does not end with a newline. + # Default: 0 force-case-trailing-whitespace: 0 + + # Enforces that an `if` statement checking an error variable is cuddled + # with the line that assigned that error variable. + # Default: false force-err-cuddling: false + + # Enforces that an assignment which is actually a short declaration (using `:=`) + # is only allowed to cuddle with other short declarations, and not plain assignments, blocks, etc. + # This rule helps make declarations stand out by themselves, much the same as grouping var statement. + # Default: false force-short-decl-cuddling: false + + # Controls if the checks for slice append should be "strict" + # in the sense that it will only allow these assignments to be cuddled with variables being appended. + # Default: true strict-append: true # The custom section can be used to define linter plugins to be loaded at runtime. - # See README doc for more info. + # See README documentation for more info. custom: # Each custom linter should have a unique name. - example: - # The path to the plugin *.so. Can be absolute or local. Required for each custom linter + example: + # The path to the plugin *.so. Can be absolute or local. + # Required for each custom linter. path: /path/to/example.so - # The description of the linter. Optional, just for documentation purposes. + # The description of the linter. + # Optional. description: This is an example usage of a plugin linter. - # Intended to point to the repo location of the linter. Optional, just for documentation purposes. + # Intended to point to the repo location of the linter. + # Optional. original-url: github.com/golangci/example-linter + linters: + # Disable all linters. disable-all: true + # Enable specific linter + # https://golangci-lint.run/usage/linters/#enabled-by-default-linters enable: - - megacheck + - asciicheck + - bidichk + - bodyclose + - contextcheck + - cyclop + - deadcode + - depguard + - dogsled + - dupl + - durationcheck + - errcheck + - errname + - errorlint + - exhaustive + - exhaustivestruct + - exportloopref + - forbidigo + - forcetypeassert + - funlen + - gci + - gochecknoglobals + - gochecknoinits + - gocognit + - goconst + - gocritic + - gocyclo + - godot + - godox + - goerr113 + - gofmt + - gofumpt + - goheader + - goimports + - golint + - gomnd + - gomoddirectives + - gomodguard + - goprintffuncname + - gosec + - gosimple - govet + - ifshort + - importas + - ineffassign + - interfacer + - ireturn + - lll + - makezero + - maligned + - misspell + - nakedret + - nestif + - nilerr + - nilnil + - nlreturn + - noctx + - nolintlint + - paralleltest + - prealloc + - predeclared + - promlinter + - revive + - rowserrcheck + - scopelint + - sqlclosecheck + - staticcheck + - structcheck + - stylecheck + - tagliatelle + - tenv + - testpackage + - thelper + - tparallel + - typecheck + - unconvert + - unparam + - unused + - varcheck + - varnamelen + - wastedassign + - whitespace + - wrapcheck + - wsl + + # Enable all available linters. enable-all: true + # Disable specific linter + # https://golangci-lint.run/usage/linters/#disabled-by-default-linters--e--enable disable: + - asciicheck + - bidichk + - bodyclose + - contextcheck + - cyclop + - deadcode + - depguard + - dogsled + - dupl + - durationcheck + - errcheck + - errname + - errorlint + - exhaustive + - exhaustivestruct + - exportloopref + - forbidigo + - forcetypeassert + - funlen + - gci + - gochecknoglobals + - gochecknoinits + - gocognit + - goconst + - gocritic + - gocyclo + - godot + - godox + - goerr113 + - gofmt + - gofumpt + - goheader + - goimports + - golint + - gomnd + - gomoddirectives + - gomodguard + - goprintffuncname + - gosec + - gosimple + - govet + - ifshort + - importas + - ineffassign + - interfacer + - ireturn + - lll + - makezero - maligned + - misspell + - nakedret + - nestif + - nilerr + - nilnil + - nlreturn + - noctx + - nolintlint + - paralleltest - prealloc + - predeclared + - promlinter + - revive + - rowserrcheck + - scopelint + - sqlclosecheck + - staticcheck + - structcheck + - stylecheck + - tagliatelle + - tenv + - testpackage + - thelper + - tparallel + - typecheck + - unconvert + - unparam + - unused + - varcheck + - varnamelen + - wastedassign + - whitespace + - wrapcheck + - wsl + + # Enable presets. + # https://golangci-lint.run/usage/linters presets: - bugs + - comment + - complexity + - error + - format + - import + - metalinter + - module + - performance + - sql + - style + - test - unused - fast: false + + # Run only fast linters from enabled linters set (first run won't be fast) + # Default: false + fast: true issues: - # List of regexps of issue texts to exclude, empty list by default. - # But independently from this option we use default exclude patterns, - # it can be disabled by `exclude-use-default: false`. To list all - # excluded by default patterns execute `golangci-lint run --help` + # List of regexps of issue texts to exclude. + # + # But independently of this option we use default exclude patterns, + # it can be disabled by `exclude-use-default: false`. + # To list all excluded by default patterns execute `golangci-lint run --help` + # + # Default: [] exclude: - abcdef @@ -777,79 +1760,89 @@ issues: - gosec # Exclude known linters from partially hard-vendored code, - # which is impossible to exclude via "nolint" comments. + # which is impossible to exclude via `nolint` comments. - path: internal/hmac/ text: "weak cryptographic primitive" linters: - gosec - # Exclude some staticcheck messages + # Exclude some `staticcheck` messages. - linters: - staticcheck text: "SA9003:" - # Exclude lll issues for long lines with go:generate + # Exclude `lll` issues for long lines with `go:generate`. - linters: - lll source: "^//go:generate " - # Independently from option `exclude` we use default exclude patterns, - # it can be disabled by this option. To list all - # excluded by default patterns execute `golangci-lint run --help`. - # Default value for this option is true. + # Independently of option `exclude` we use default exclude patterns, + # it can be disabled by this option. + # To list all excluded by default patterns execute `golangci-lint run --help`. + # Default: true. exclude-use-default: false - # The default value is false. If set to true exclude and exclude-rules - # regular expressions become case sensitive. + # If set to true exclude and exclude-rules regular expressions become case-sensitive. + # Default: false exclude-case-sensitive: false - # The list of ids of default excludes to include or disable. By default it's empty. + # The list of ids of default excludes to include or disable. + # Default: [] include: - - EXC0002 # disable excluding of issues about comments from golint + - EXC0002 # disable excluding of issues about comments from golint. - # Maximum issues count per one linter. Set to 0 to disable. Default is 50. + # Maximum issues count per one linter. + # Set to 0 to disable. + # Default: 50 max-issues-per-linter: 0 - # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. + # Maximum count of issues with the same text. + # Set to 0 to disable. + # Default: 3 max-same-issues: 0 # Show only new issues: if there are unstaged changes or untracked files, # only those changes are analyzed, else only changes in HEAD~ are analyzed. - # It's a super-useful option for integration of golangci-lint into existing - # large codebase. It's not practical to fix all existing issues at the moment - # of integration: much better don't allow issues in new code. - # Default is false. - new: false + # It's a super-useful option for integration of golangci-lint into existing large codebase. + # It's not practical to fix all existing issues at the moment of integration: + # much better don't allow issues in new code. + # + # Default: false. + new: true - # Show only new issues created after git revision `REV` - new-from-rev: REV + # Show only new issues created after git revision `REV`. + new-from-rev: HEAD # Show only new issues created in git patch with set file path. new-from-patch: path/to/patch/file - # Fix found issues (if it's supported by the linter) + # Fix found issues (if it's supported by the linter). fix: true + severity: - # Default value is empty string. - # Set the default severity for issues. If severity rules are defined and the issues - # do not match or no severity is provided to the rule this will be the default - # severity applied. Severities should match the supported severity names of the - # selected out format. + # Set the default severity for issues. + # + # If severity rules are defined and the issues do not match or no severity is provided to the rule + # this will be the default severity applied. + # Severities should match the supported severity names of the selected out format. # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity - # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity - # - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message + # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity + # - GitHub: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message + # + # Default value is an empty string. default-severity: error - # The default value is false. - # If set to true severity-rules regular expressions become case sensitive. - case-sensitive: false + # If set to true `severity-rules` regular expressions become case-sensitive. + # Default: false + case-sensitive: true - # Default value is empty list. - # When a list of severity rules are provided, severity information will be added to lint - # issues. Severity rules have the same filtering capability as exclude rules except you - # are allowed to specify one matcher per severity rule. + # When a list of severity rules are provided, severity information will be added to lint issues. + # Severity rules have the same filtering capability as exclude rules + # except you are allowed to specify one matcher per severity rule. # Only affects out formats that support setting severity information. + # + # Default: [] rules: - linters: - dupl diff --git a/.golangci.yml b/.golangci.yml index 18386725cc95..3cc116d03bf8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,7 +16,7 @@ linters-settings: local-prefixes: github.com/golangci/golangci-lint goconst: min-len: 2 - min-occurrences: 2 + min-occurrences: 3 gocritic: enabled-tags: - diagnostic @@ -35,10 +35,14 @@ linters-settings: goimports: local-prefixes: github.com/golangci/golangci-lint gomnd: + # TODO(ldez) must be rewritten after the v1.44.0 release. settings: mnd: # don't include the "operation" and "assign" checks: argument,case,condition,return + ignored-numbers: 0,1,2,3 + ignored-functions: strings.SplitN + govet: check-shadowing: true settings: @@ -68,7 +72,6 @@ linters: - dupl - errcheck - exportloopref - - exhaustive - funlen - gochecknoinits - goconst @@ -87,7 +90,6 @@ linters: - nakedret - noctx - nolintlint - - rowserrcheck - staticcheck - structcheck - stylecheck @@ -115,9 +117,6 @@ linters: # - wsl issues: - exclude: - # disable this rule for go1.15 compatibility - - 'ioutilDeprecated:' # Excluding configuration per-path, per-linter, per-text and per-source exclude-rules: - path: _test\.go @@ -128,21 +127,11 @@ issues: text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - path: pkg/commands/run.go text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - # TODO must be removed after the release of the next version (v1.41.0) - path: pkg/commands/run.go - linters: - - gomnd - # TODO must be removed after the release of the next version (v1.41.0) - - path: pkg/golinters/nolintlint/nolintlint.go - linters: - - gomnd - # TODO must be removed after the release of the next version (v1.41.0) - - path: pkg/printers/tab.go - linters: - - gomnd + text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." run: + timeout: 5m skip-dirs: - test/testdata_etc - internal/cache diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e53b2dd631..871341ad2ae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,25 +1,68 @@ Follow the news and releases on our [twitter](https://twitter.com/golangci) and our [blog](https://medium.com/golangci). There is the most valuable changes log: +### November 2021 + +1. new linters: + * `bidichk`: https://github.com/breml/bidichk +2. update linters: + * `nestif`: from 0.3.0 to 0.3.1 + * `rowserrcheck`: from 1.1.0 to 1.1.1 + * `gopsutil`: from 3.21.9 to 3.21.10 + * `wrapcheck`: from 2.3.1 to 2.4.0 + * `gocritic`: add support for variable substitution in `ruleguard` path settings +3. documentation: + * improve `go-critic` documentation + * improve `nolintlint` documentation +4. Misc: + * cli: don't hide `enable-all` option + +### october 2021 + +1. new linters: + * `contextcheck`: https://github.com/sylvia7788/contextcheck + * `varnamelen`: https://github.com/blizzy78/varnamelen +2. update linters: + * `gochecknoglobals`: to v0.1.0 + * `gosec`: filter issues according to the severity and confidence + * `errcheck`: empty selector name. + * `ifshort`: from 1.0.2 to 1.0.3 + * `go-critic`: from 0.5.6 to 0.6.0 + * `gosec`: from 2.8.1 to 2.9.1 + * `durationcheck`: from 0.0.8 to 0.0.9 + * `wrapcheck`: from 2.3.0 to 2.3.1 + * `revive`: from 1.1.1 to 1.1.2 + ### September 2021 -1. update linters: +1. new linters: + * `ireturn`: https://github.com/butuzov/ireturn + * `nilnil`: https://github.com/Antonboom/nilnil + * `tenv`: https://github.com/sivchari/tenv +2. update linters: * `errcheck`: update to HEAD + * `errname`: from 0.1.4 to 0.1.5 * `gci`: Parse the settings more similarly to the CLI + * `godot`: from 1.4.9 to 1.4.11 + * `ireturn`: from 0.1.0 to 0.1.1 + * `nlreturn`: add block-size option + * `paralleltest`: from 1.0.2 to 1.0.3 +3. Misc: + * new-from-rev: add support for finding issues in entire files in a diff ### August 2021 1. new linters: - * Add `errname` linter + * `errname`: https://github.com/Antonboom/errname 2. update linters: - * `errname` from 0.1.3 to 0.1.4 + * `errname`: from 0.1.3 to 0.1.4 * `go-critic`: fix invalid type conversions. * `godot`: from 1.4.8 to 1.4.9 * `gomodguard`: from 1.2.2 to 1.2.3 * `revive`: from 1.0.9 to 1.1.1 * `staticcheck`: bump to 2021.1.1 (v0.2.1) * `wrapcheck`: bump to v2.3.0 -4. Misc: +3. Misc: * build binaries and Docker images with go1.17 ### July 2021 diff --git a/Makefile b/Makefile index 1f94ecb691be..1ba54cb23ebe 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,12 @@ test: build GL_TEST_RUN=1 go test -v -parallel 2 ./... .PHONY: test +# ex: T=gofmt.go make test_fix +# the value of `T` is the name of a file from `test/testdata/fix` +test_fix: build + GL_TEST_RUN=1 go test -v ./test -count 1 -run TestFix/$T +.PHONY: test_fix + test_race: build_race GL_TEST_RUN=1 ./golangci-lint run -v --timeout=5m .PHONY: test_race diff --git a/README.md b/README.md index c53c093e9def..0ae008c5aff6 100644 --- a/README.md +++ b/README.md @@ -74,347 +74,368 @@ The Core Team has the following responsibilities:
@iwankgb

Andrew Shannon Brown
-
Oleg Butuzov
+
Oleg Butuzov

Ryan Currah

Denis Tingaikin

Denis Krivak

Pierre Durand
+
Sebastien Rosset

Alexey Palazhchenko

Duco van Amstel
-
David Lobe

Kensei Nakada
+
David Lobe

Melvin
-
Nishanth Shanmugham
-
Matouš Dzivjak
+
Nishanth Shanmugham
+
sivchari
+
Matouš Dzivjak

Alec Thomas

Will Dixon
-
Sebastien Rosset
+
Iskander (Alex) Sharipov

Mateusz Gozdek

Michael Mulligan
-
Nuruddin Ashr
-
Joe Wilner
+
Nuruddin Ashr
+
Joe Wilner

Soichiro Kashima
-
sivchari
+
Anton Telyshev

Tim Heckman
+
Mitsuo Heijo

Colin Arnott
-
James
-
Luke Shumaker
-
Dan Kortschak
-And 235 more our team members +And 252 more our team members + + + - - - - - + + - + + + - - + - + - - - + + + - + + - - + + - - + + - - + + + + + + - - - + + + - - + + - - + + + - + - - + + + + - - - - - + + + - + + + - + - + - + - + - - + + + + - - + + - - + + - - + + - - - + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + - - + + - - - - + + - + + + - + - + + + - + +

James

Luke Shumaker

Dan Kortschak

Ryan Boehning

Anton Telyshev

Kamil Samigullin

Iskander (Alex) Sharipov

Aliaksandr Mianzhynski

Mitsuo Heijo

@golangci-releaser

Kamil Samigullin

Steve Coffman

Romanos

Aliaksandr Mianzhynski

Rski

Aneesh Agrawal

Vladimir Evgrafov

Peter Mescalchin

sonatard

ZhangYunHao

gaojingyu

Peter Mescalchin

gaojingyu

@odidev

NiseVoid

Sean DuBois

Viktoras

Agniva De Sarker

Henrik Johansson

Eugene Simonov

Eugene Simonov

SystemGlitch

Tom Arrell

John Starich

Koichi Shiraishi

Bart

Steve Coffman

Patrick Kuca

Bart

David Braley

Patrick Kuca

Viacheslav Poturaev

David Braley

Lukas Malkmus

Chris Bandy

Nate Finch

Neha Viswanathan

Lukas Malkmus

Robert Liebowitz

Aleksey Bakin

Aleksey Bakin

Zeal Wierslee

Kunwardeep

Pierre R

Stephan Renatus

Gustavo Bazan

Diego Pontoriero

Daniel Helfand

Zik

Daniel Helfand

Zik

Alex Collins

Ryo Nakao

Tommy Mühle

@kyoh86

Sebastiaan van Stijn

@Dominik-K

ferhat elmas

@Dominik-K

Craig Silverstein

Bartłomiej Klimczak

ferhat elmas

Faisal Alam

M. Ángel Jimeno

Chris Drew

Marat Reymers

Teiva Harsanyi

Craig Silverstein

Kailun Qin

Ariel Mashraki

Denis Isaev

Tom Payne

francisco souza

Ryan Olds

Maik Schreiber

Hiroki Suezawa

Fabrice

Christoph Blecker

Mateusz Bilski

Ben Ye

Stephanie Wilde-Hobbs

Cory LaNou

Vitaly Isaev

Shulhan

Renato Suero

tdakkota

Ben Wells

Brian Flad

Sean McGinnis

Jakub Chábek

tdakkota

Oleksandr Redko

Eric Wohltman

Borja Clemente

Kir Kolyshkin

masibw

Gianguido Sora'

Pete Wagner

Sonia Hamilton

Berezhnoy Pavel

Henry

Sindre Røkenes Myren

Sindre Røkenes Myren

Aofei Sheng

Bartłomiej Klimczak

Gustavo Bazan

Maksym Pavlenko

Jonathan Chappelow

Ivan

James Lucktaylor

Dale Hui

Ondrej Fabry

Kishan B

proton

Ghvst Code

Markus

Sebastian Spaink

Sebastian Spaink

Andrew Lavery

Lucas Bremgartner

Andrew Lavery

Tariq Ibrahim

Peter Štibraný

kaixiang zhong

@ced42

David Bariod

Derek Perkins

Eldar Rakhimberdin

Eldar Rakhimberdin

Toon Schoenmakers

Cezar Sá Espinola

Ben Paxton

Andrey Kuchin

Connor Adams

Draven

Martins Irbe

Martins Irbe

Rodrigo Brito

takaya

Mark Sart

Joshua Rubin

Linus Arver

Glen Mailer

Ian Howell

Ian Howell

Chris K

Grigory Zubankov

@xxpxxxxp

subham sarkar

Tyler Beverley

Marko

Chris Lewis

sylvia

Ryan Leung

Marko

Chris Lewis

David Gleich

Muhammad Ikhsan

Denis Titusov

Terdunov Vyacheslav

Sean Chittenden

Hui Zhu

@Harsimran1

Hui Zhu

@Harsimran1

rinsuki

Anton Antonov

@hn8

☃ Elliot Shepherd

@nvartolomei

Martin Etmajer

@techknowlogick

Martin Etmajer

@techknowlogick

Fisher Xu

Matthew Poer

Cody Ley-Han

Marc Tudurí

Patrick Zhang

Katsunori Tanaka

@to6ka

@darklore

@to6ka

@evalexpr

Collin Kreklow

Grigory Zubankov

Marcin Owsiany

C.J. Jameson

Jack

@ofw

Boban Acimovic

@ofw

Benjamin

@sg0hsmt

Boban Acimovic

David Hill

Troy Ronda

Osamu TONOMORI

Bo Liu

Steven Allen

Colin Arnott

Eran Levy

Roman Leventov

Eric Jain

Hugo Osvaldo Barrera

Michael

Evgeniy Kulikov

Chris Nesbitt-Smith

Daniel Caballero

Carlton Henderson

Shintaro Ikeda

Matt Braymer-Hayes

@xuri

Charl Matthee

Sriram Venkatesh

Peter Schuller

David Golub

Alexander Morozov

@hbandura

Liam White

Alex Dupre

Juanito

Jinming Yue

Igor Zibarev

@wxdao

Kévin Dunglas

Sijie Yang

Stephen

Thang Minh Vu

Julia Ogris

Greg Curtis

@ac-rappi

Dudás Ádám

Abhishek | अभिषेक

Daniele

Takumasa Sakao

Ben Drucker

Stephen Brown II

Matthew Cobbing

paul fisher

@Darlez

Kirill Danshin

Kevin Gillette

Irina

Petr Pučil

Aaron Bennett

Dima

Dima

Alexandre Vilain

Alessio Treglia

Alay Patel

Martin Hutchinson

Emanuel Bennici

Mayo

Mayo Cream

Christian Clauss

sylvia

Christian Clauss

Johannes Liebermann

Korjavin Ivan

Eng Zer Jun

Tibo Delor

Francois Parquet

Robert Kopaczewski

@opennota

Cyrille Meichel

neglect-yp

@sg0hsmt

@jumpeiMano

Federico Guerinoni

Alex Rodin

Wei Jian Gan

Tamás Gulácsi

Tamás Gulácsi

Jack Wilsdon

Michał Suchwałko

Alexander Apalikov

Domas Tamašauskas

Stéphane Chausson

neo_sli

@srdhoni

@srdhoni

@derekhuizhang

Leo Takaoka

Matias Lahti

Sean Schneeweiss

Thomas Bonfort

Matthieu MOREL

Matthieu MOREL

Tomas Dabasinskas
diff --git a/assets/github-action-config.json b/assets/github-action-config.json index f647885dd189..cae531dccb8b 100644 --- a/assets/github-action-config.json +++ b/assets/github-action-config.json @@ -1,8 +1,8 @@ { "MinorVersionToConfig": { "latest": { - "TargetVersion": "v1.42.1", - "AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-1.42.1-linux-amd64.tar.gz" + "TargetVersion": "v1.43.0", + "AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.43.0/golangci-lint-1.43.0-linux-amd64.tar.gz" }, "v1.10": { "Error": "golangci-lint version 'v1.10' isn't supported: we support only v1.14.0 and later versions" @@ -138,6 +138,10 @@ "TargetVersion": "v1.42.1", "AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-1.42.1-linux-amd64.tar.gz" }, + "v1.43": { + "TargetVersion": "v1.43.0", + "AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.43.0/golangci-lint-1.43.0-linux-amd64.tar.gz" + }, "v1.5": { "Error": "golangci-lint version 'v1.5' isn't supported: we support only v1.14.0 and later versions" }, diff --git a/docs/package-lock.json b/docs/package-lock.json index 3a4edba037c6..351f9db71057 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -9,8 +9,8 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@emotion/react": "^11.5.0", - "@emotion/styled": "^11.3.0", + "@emotion/react": "^11.7.1", + "@emotion/styled": "^11.6.0", "@mdx-js/mdx": "^1.6.22", "@mdx-js/react": "^1.6.16", "gatsby": "^2.32.13", @@ -18,19 +18,19 @@ "gatsby-plugin-canonical-urls": "^2.10.0", "gatsby-plugin-catch-links": "^2.10.0", "gatsby-plugin-emotion": "^5.0.0", - "gatsby-plugin-google-analytics": "^4.0.0", + "gatsby-plugin-google-analytics": "^4.4.0", "gatsby-plugin-manifest": "^2.12.1", "gatsby-plugin-mdx": "^2.14.0", "gatsby-plugin-netlify": "^2.11.1", "gatsby-plugin-netlify-cache": "^2.0.0", - "gatsby-plugin-offline": "^5.0.0", + "gatsby-plugin-offline": "^5.4.0", "gatsby-plugin-react-helmet": "^3.10.0", "gatsby-plugin-react-svg": "^3.1.0", "gatsby-plugin-robots-txt": "^1.6.14", "gatsby-plugin-sharp": "^3.10.2", - "gatsby-plugin-sitemap": "^5.0.0", + "gatsby-plugin-sitemap": "^5.4.0", "gatsby-remark-autolink-headers": "^2.11.0", - "gatsby-remark-copy-linked-files": "^5.0.0", + "gatsby-remark-copy-linked-files": "^5.4.0", "gatsby-remark-embedder": "^4.2.0", "gatsby-remark-external-links": "0.0.4", "gatsby-remark-images": "^3.11.1", @@ -42,8 +42,8 @@ "gatsby-transformer-yaml": "^2.11.0", "polished": "^4.1.3", "prism-react-renderer": "^1.2.1", - "prop-types": "^15.7.2", - "puppeteer": "^10.4.0", + "prop-types": "^15.8.0", + "puppeteer": "^13.0.1", "react": "^17.0.2", "react-dom": "^17.0.2", "react-headroom": "^3.2.0", @@ -2251,21 +2251,21 @@ } }, "node_modules/@emotion/cache": { - "version": "11.5.0", - "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.5.0.tgz", - "integrity": "sha512-mAZ5QRpLriBtaj/k2qyrXwck6yeoz1V5lMt/jfj6igWU35yYlNKs2LziXVgvH81gnJZ+9QQNGelSsnuoAy6uIw==", + "version": "11.7.1", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.7.1.tgz", + "integrity": "sha512-r65Zy4Iljb8oyjtLeCuBH8Qjiy107dOYC6SJq7g7GV5UCQWMObY4SJDPGFjiiVpPrOJ2hmJOoBiYTC7hwx9E2A==", "dependencies": { "@emotion/memoize": "^0.7.4", - "@emotion/sheet": "^1.0.3", + "@emotion/sheet": "^1.1.0", "@emotion/utils": "^1.0.0", "@emotion/weak-memoize": "^0.2.5", - "stylis": "^4.0.10" + "stylis": "4.0.13" } }, "node_modules/@emotion/cache/node_modules/stylis": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", - "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.13.tgz", + "integrity": "sha512-xGPXiFVl4YED9Jh7Euv2V220mriG9u4B2TA6Ybjc1catrstKD2PpIdU3U0RKpkVBC2EhmL/F0sPCr9vrFTNRag==" }, "node_modules/@emotion/hash": { "version": "0.8.0", @@ -2273,9 +2273,9 @@ "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" }, "node_modules/@emotion/is-prop-valid": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.1.0.tgz", - "integrity": "sha512-9RkilvXAufQHsSsjQ3PIzSns+pxuX4EW8EbGeSPjZMHuMx6z/MOzb9LpqNieQX4F3mre3NWS2+X3JNRHTQztUQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.1.1.tgz", + "integrity": "sha512-bW1Tos67CZkOURLc0OalnfxtSXQJMrAMV0jZTVGJUPSOd4qgjF3+tTD5CwJM13PHA8cltGW1WGbbvV9NpvUZPw==", "dependencies": { "@emotion/memoize": "^0.7.4" } @@ -2286,14 +2286,14 @@ "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" }, "node_modules/@emotion/react": { - "version": "11.5.0", - "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.5.0.tgz", - "integrity": "sha512-MYq/bzp3rYbee4EMBORCn4duPQfgpiEB5XzrZEBnUZAL80Qdfr7CEv/T80jwaTl/dnZmt9SnTa8NkTrwFNpLlw==", + "version": "11.7.1", + "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.7.1.tgz", + "integrity": "sha512-DV2Xe3yhkF1yT4uAUoJcYL1AmrnO5SVsdfvu+fBuS7IbByDeTVx9+wFmvx9Idzv7/78+9Mgx2Hcmr7Fex3tIyw==", "dependencies": { "@babel/runtime": "^7.13.10", - "@emotion/cache": "^11.5.0", + "@emotion/cache": "^11.7.1", "@emotion/serialize": "^1.0.2", - "@emotion/sheet": "^1.0.3", + "@emotion/sheet": "^1.1.0", "@emotion/utils": "^1.0.0", "@emotion/weak-memoize": "^0.2.5", "hoist-non-react-statics": "^3.3.1" @@ -2329,18 +2329,18 @@ "integrity": "sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==" }, "node_modules/@emotion/sheet": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.3.tgz", - "integrity": "sha512-YoX5GyQ4db7LpbmXHMuc8kebtBGP6nZfRC5Z13OKJMixBEwdZrJ914D6yJv/P+ZH/YY3F5s89NYX2hlZAf3SRQ==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.1.0.tgz", + "integrity": "sha512-u0AX4aSo25sMAygCuQTzS+HsImZFuS8llY8O7b9MDRzbJM0kVJlAz6KNDqcG7pOuQZJmj/8X/rAW+66kMnMW+g==" }, "node_modules/@emotion/styled": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.3.0.tgz", - "integrity": "sha512-fUoLcN3BfMiLlRhJ8CuPUMEyKkLEoM+n+UyAbnqGEsCd5IzKQ7VQFLtzpJOaCD2/VR2+1hXQTnSZXVJeiTNltA==", + "version": "11.6.0", + "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.6.0.tgz", + "integrity": "sha512-mxVtVyIOTmCAkFbwIp+nCjTXJNgcz4VWkOYQro87jE2QBTydnkiYusMrRGFtzuruiGK4dDaNORk4gH049iiQuw==", "dependencies": { "@babel/runtime": "^7.13.10", "@emotion/babel-plugin": "^11.3.0", - "@emotion/is-prop-valid": "^1.1.0", + "@emotion/is-prop-valid": "^1.1.1", "@emotion/serialize": "^1.0.2", "@emotion/utils": "^1.0.0" }, @@ -7034,9 +7034,9 @@ } }, "node_modules/common-tags": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz", - "integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", + "integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==", "engines": { "node": ">=4.0.0" } @@ -8233,9 +8233,9 @@ } }, "node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dependencies": { "ms": "2.1.2" }, @@ -8803,9 +8803,9 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.901419", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.901419.tgz", - "integrity": "sha512-4INMPwNm9XRpBukhNbF7OB6fNTTCaI8pzy/fXg0xQzAy5h3zL1P8xT3QazgKqBrb/hAYwIBizqDBZ7GtJE74QQ==" + "version": "0.0.937139", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.937139.tgz", + "integrity": "sha512-daj+rzR3QSxsPRy5vjjthn58axO8c11j58uY0lG5vvlJk/EiOdCWOptGdkXDjtuRHr78emKq0udHCXM4trhoDQ==" }, "node_modules/dicer": { "version": "0.3.0", @@ -11789,9 +11789,9 @@ } }, "node_modules/gatsby-plugin-google-analytics": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-4.0.0.tgz", - "integrity": "sha512-VZAy7aVaMMIKJgcQPWXnwKZqKNY8fA4ugdx+/7lzTGSrDs1extX8SVdwA8UCHjkL799vEveRkNFXOP4Bb01khg==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-4.4.0.tgz", + "integrity": "sha512-Z+CW64zo/d1rtyMz1bJ+Ao9apsWeyak5BXNc7piO+FwE7dFdWrAyHrgGmE3YltqFUY8+PS3vmpBv9qn0ZrOSGg==", "dependencies": { "@babel/runtime": "^7.15.4", "minimatch": "3.0.4", @@ -12269,14 +12269,14 @@ } }, "node_modules/gatsby-plugin-offline": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-offline/-/gatsby-plugin-offline-5.0.0.tgz", - "integrity": "sha512-+7poj4PzZjJc5sN77KTyjRGJaWhPeoPaPLxlvzz/x1iCTsJCPdQcPY/TeoRbzSk5BFyU94KgPejYdvBl5i/Upg==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/gatsby-plugin-offline/-/gatsby-plugin-offline-5.4.0.tgz", + "integrity": "sha512-dxFRgsKmWovjH8m0HWHao9sdcXy4X0X9SPlZETHk54ARY/wrzxVg266fA+ZVI7RPpuODBcgWoXWHuTtplfghBw==", "dependencies": { "@babel/runtime": "^7.15.4", "cheerio": "^1.0.0-rc.10", - "gatsby-core-utils": "^3.0.0", - "glob": "^7.1.7", + "gatsby-core-utils": "^3.4.0", + "glob": "^7.2.0", "idb-keyval": "^3.2.0", "lodash": "^4.17.21", "workbox-build": "^4.3.1" @@ -12465,17 +12465,17 @@ } }, "node_modules/gatsby-plugin-offline/node_modules/gatsby-core-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-3.0.0.tgz", - "integrity": "sha512-MEQAgP+/ddDTOjcfRhyZenLfr6q3nyh01muI6QTgz0qAFsbS50lZh9SbczgpuKnb6qiST1KR0OUIYTaBFXfB2g==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-3.4.0.tgz", + "integrity": "sha512-dYQpyo1BLGJzxQOXgGs1Fbj7jzGj5cKAIPYz2hz2l4Aus6skwjjaUlOjZlrWIahNHoLkx3mH0f5y6E8205T/aQ==", "dependencies": { "@babel/runtime": "^7.15.4", "ci-info": "2.0.0", "configstore": "^5.0.1", "file-type": "^16.5.3", "fs-extra": "^10.0.0", - "got": "^11.8.2", - "node-object-hash": "^2.3.9", + "got": "^11.8.3", + "node-object-hash": "^2.3.10", "proper-lockfile": "^4.1.2", "tmp": "^0.2.1", "xdg-basedir": "^4.0.0" @@ -12499,16 +12499,16 @@ } }, "node_modules/gatsby-plugin-offline/node_modules/got": { - "version": "11.8.2", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.2.tgz", - "integrity": "sha512-D0QywKgIe30ODs+fm8wMZiAcZjypcCodPNuMz5H9Mny7RJ+IjJ10BdmGW7OM7fHXP+O7r6ZwapQ/YQmMSvB0UQ==", + "version": "11.8.3", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.3.tgz", + "integrity": "sha512-7gtQ5KiPh1RtGS9/Jbv1ofDpBFuq42gyfEib+ejaRBJuj/3tQFeR5+gw57e4ipaU8c/rCjvX6fkQz2lyDlGAOg==", "dependencies": { "@sindresorhus/is": "^4.0.0", "@szmarczak/http-timer": "^4.0.5", "@types/cacheable-request": "^6.0.1", "@types/responselike": "^1.0.0", "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.1", + "cacheable-request": "^7.0.2", "decompress-response": "^6.0.0", "http2-wrapper": "^1.0.0-beta.5.2", "lowercase-keys": "^2.0.0", @@ -12603,9 +12603,9 @@ } }, "node_modules/gatsby-plugin-offline/node_modules/peek-readable": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.1.tgz", - "integrity": "sha512-7qmhptnR0WMSpxT5rMHG9bW/mYSR1uqaPFj2MHvT+y/aOUu6msJijpKt5SkTDKySwg65OWG2JwTMBlgcbwMHrQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.2.tgz", + "integrity": "sha512-9fMaz6zoxw9ypO1KZy5RDJgSupEtu0Q+g/OqqsVHX3rKGR8qehRLYzsFARZ4bVvdvfknKiXvuDbkMnO1g6cRpQ==", "engines": { "node": ">=8" }, @@ -13176,12 +13176,12 @@ } }, "node_modules/gatsby-plugin-sitemap": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-sitemap/-/gatsby-plugin-sitemap-5.0.0.tgz", - "integrity": "sha512-f2J/9xfO9+BHPwEtUzkJu5BXSPqxpoSPdtca5+3qyEA8uoaBl1jS9D2XgkzVLtsSkM4uxDLc0NKy3j0N/ZS79A==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/gatsby-plugin-sitemap/-/gatsby-plugin-sitemap-5.4.0.tgz", + "integrity": "sha512-Zwbp9BLzhjkxHm5Vvu8Kf1U+okbdVM6M6YVs7pQl3FnOMLZZ8huXHJgRnsjSyEmxENsKeelUttONBcgh38zDLA==", "dependencies": { "@babel/runtime": "^7.15.4", - "common-tags": "^1.8.0", + "common-tags": "^1.8.2", "minimatch": "^3.0.4", "sitemap": "^7.0.0" }, @@ -13500,9 +13500,9 @@ } }, "node_modules/gatsby-remark-copy-linked-files": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gatsby-remark-copy-linked-files/-/gatsby-remark-copy-linked-files-5.0.0.tgz", - "integrity": "sha512-bfqtMeb+IR1YfELoNfw+Td5BjHa9HYrgDQi/dHPj8b/ay+vexDL6TzbLuStDVzqkvSC93aboGm2k5SvKAw5aIA==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/gatsby-remark-copy-linked-files/-/gatsby-remark-copy-linked-files-5.4.0.tgz", + "integrity": "sha512-bU0jcNS5yv+WHziyxl/K3fceLyf96MQlwZzQQkGwAkfuWxEsDh15EaaT/atJbj9T0ZlccuGzXSRj7kxFlhEmPw==", "dependencies": { "@babel/runtime": "^7.15.4", "cheerio": "^1.0.0-rc.10", @@ -14779,9 +14779,9 @@ "integrity": "sha1-xs0OwbBkLio8Z6ETfvxeeW2k+I4=" }, "node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -19605,9 +19605,9 @@ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" }, "node_modules/node-object-hash": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-2.3.9.tgz", - "integrity": "sha512-NQt1YURrMPeQGZzW4lRbshUEF2PqxJEZYY4XJ/L+q33dI8yPYvnb7QXmwUcl1EuXluzeY4TEV+H6H0EmtI6f5g==", + "version": "2.3.10", + "resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-2.3.10.tgz", + "integrity": "sha512-jY5dPJzw6NHd/KPSfPKJ+IHoFS81/tJ43r34ZeNMXGzCOM8jwQDCD12HYayKIB6MuznrnqIYy2e891NA2g0ibA==", "engines": { "node": ">=0.10.0" } @@ -21967,13 +21967,13 @@ } }, "node_modules/prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "version": "15.8.0", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.0.tgz", + "integrity": "sha512-fDGekdaHh65eI3lMi5OnErU6a8Ighg2KjcjQxO7m8VHyWjcPyj5kiOgV1LQDOOOgVy3+5FgjXvdSSX7B8/5/4g==", "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", - "react-is": "^16.8.1" + "react-is": "^16.13.1" } }, "node_modules/proper-lockfile": { @@ -22097,54 +22097,57 @@ } }, "node_modules/puppeteer": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-10.4.0.tgz", - "integrity": "sha512-2cP8mBoqnu5gzAVpbZ0fRaobBWZM8GEUF4I1F6WbgHrKV/rz7SX8PG2wMymZgD0wo0UBlg2FBPNxlF/xlqW6+w==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.0.1.tgz", + "integrity": "sha512-wqGIx59LzYqWhYcJQphMT+ux0sgatEUbjKG0lbjJxNVqVIT3ZC5m4Bvmq2gHE3qhb63EwS+rNkql08bm4BvO0A==", "hasInstallScript": true, "dependencies": { - "debug": "4.3.1", - "devtools-protocol": "0.0.901419", + "debug": "4.3.2", + "devtools-protocol": "0.0.937139", "extract-zip": "2.0.1", "https-proxy-agent": "5.0.0", - "node-fetch": "2.6.1", + "node-fetch": "2.6.5", "pkg-dir": "4.2.0", - "progress": "2.0.1", + "progress": "2.0.3", "proxy-from-env": "1.1.0", "rimraf": "3.0.2", - "tar-fs": "2.0.0", - "unbzip2-stream": "1.3.3", - "ws": "7.4.6" + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.2.3" }, "engines": { "node": ">=10.18.1" } }, - "node_modules/puppeteer/node_modules/progress": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz", - "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/puppeteer/node_modules/tar-fs": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.0.tgz", - "integrity": "sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA==", + "node_modules/puppeteer/node_modules/node-fetch": { + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "dependencies": { - "chownr": "^1.1.1", - "mkdirp": "^0.5.1", - "pump": "^3.0.0", - "tar-stream": "^2.0.0" + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" } }, - "node_modules/puppeteer/node_modules/unbzip2-stream": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.3.tgz", - "integrity": "sha512-fUlAF7U9Ah1Q6EieQ4x4zLNejrRvDWUYmxXUpN3uziFYCHapjWFaCAnreY9bGgxzaMCFAPPpYNng57CypwJVhg==", - "dependencies": { - "buffer": "^5.2.1", - "through": "^2.3.8" + "node_modules/puppeteer/node_modules/ws": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, "node_modules/q": { @@ -24192,6 +24195,7 @@ "version": "0.27.1", "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.27.1.tgz", "integrity": "sha512-IQNXWdspb4nZcJemXa6cfgz+JvKONsuqP8Mwi1Oti23Uo7+J+UF2jihJDf6I1BQbrmhcZ0lagH/1WYG+ReAzyQ==", + "hasInstallScript": true, "dependencies": { "array-flatten": "^3.0.0", "color": "^3.1.3", @@ -26059,6 +26063,11 @@ "node": ">=0.1.98" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, "node_modules/traverse": { "version": "0.6.6", "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", @@ -27558,6 +27567,11 @@ "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-1.1.2.tgz", "integrity": "sha512-PFMKIY+bRSXlMxVAQ+m2aw9c/ioUYfDgrYot0YUa+/xa0sakubWhSDyxAKwzymvXVdF4CZI71g06W+mqhzu6ig==" }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, "node_modules/webpack": { "version": "4.46.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz", @@ -28698,6 +28712,15 @@ "node": ">=0.8.0" } }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -31020,21 +31043,21 @@ } }, "@emotion/cache": { - "version": "11.5.0", - "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.5.0.tgz", - "integrity": "sha512-mAZ5QRpLriBtaj/k2qyrXwck6yeoz1V5lMt/jfj6igWU35yYlNKs2LziXVgvH81gnJZ+9QQNGelSsnuoAy6uIw==", + "version": "11.7.1", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-11.7.1.tgz", + "integrity": "sha512-r65Zy4Iljb8oyjtLeCuBH8Qjiy107dOYC6SJq7g7GV5UCQWMObY4SJDPGFjiiVpPrOJ2hmJOoBiYTC7hwx9E2A==", "requires": { "@emotion/memoize": "^0.7.4", - "@emotion/sheet": "^1.0.3", + "@emotion/sheet": "^1.1.0", "@emotion/utils": "^1.0.0", "@emotion/weak-memoize": "^0.2.5", - "stylis": "^4.0.10" + "stylis": "4.0.13" }, "dependencies": { "stylis": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.10.tgz", - "integrity": "sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg==" + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.0.13.tgz", + "integrity": "sha512-xGPXiFVl4YED9Jh7Euv2V220mriG9u4B2TA6Ybjc1catrstKD2PpIdU3U0RKpkVBC2EhmL/F0sPCr9vrFTNRag==" } } }, @@ -31044,9 +31067,9 @@ "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" }, "@emotion/is-prop-valid": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.1.0.tgz", - "integrity": "sha512-9RkilvXAufQHsSsjQ3PIzSns+pxuX4EW8EbGeSPjZMHuMx6z/MOzb9LpqNieQX4F3mre3NWS2+X3JNRHTQztUQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.1.1.tgz", + "integrity": "sha512-bW1Tos67CZkOURLc0OalnfxtSXQJMrAMV0jZTVGJUPSOd4qgjF3+tTD5CwJM13PHA8cltGW1WGbbvV9NpvUZPw==", "requires": { "@emotion/memoize": "^0.7.4" } @@ -31057,14 +31080,14 @@ "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" }, "@emotion/react": { - "version": "11.5.0", - "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.5.0.tgz", - "integrity": "sha512-MYq/bzp3rYbee4EMBORCn4duPQfgpiEB5XzrZEBnUZAL80Qdfr7CEv/T80jwaTl/dnZmt9SnTa8NkTrwFNpLlw==", + "version": "11.7.1", + "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.7.1.tgz", + "integrity": "sha512-DV2Xe3yhkF1yT4uAUoJcYL1AmrnO5SVsdfvu+fBuS7IbByDeTVx9+wFmvx9Idzv7/78+9Mgx2Hcmr7Fex3tIyw==", "requires": { "@babel/runtime": "^7.13.10", - "@emotion/cache": "^11.5.0", + "@emotion/cache": "^11.7.1", "@emotion/serialize": "^1.0.2", - "@emotion/sheet": "^1.0.3", + "@emotion/sheet": "^1.1.0", "@emotion/utils": "^1.0.0", "@emotion/weak-memoize": "^0.2.5", "hoist-non-react-statics": "^3.3.1" @@ -31090,18 +31113,18 @@ } }, "@emotion/sheet": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.0.3.tgz", - "integrity": "sha512-YoX5GyQ4db7LpbmXHMuc8kebtBGP6nZfRC5Z13OKJMixBEwdZrJ914D6yJv/P+ZH/YY3F5s89NYX2hlZAf3SRQ==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.1.0.tgz", + "integrity": "sha512-u0AX4aSo25sMAygCuQTzS+HsImZFuS8llY8O7b9MDRzbJM0kVJlAz6KNDqcG7pOuQZJmj/8X/rAW+66kMnMW+g==" }, "@emotion/styled": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.3.0.tgz", - "integrity": "sha512-fUoLcN3BfMiLlRhJ8CuPUMEyKkLEoM+n+UyAbnqGEsCd5IzKQ7VQFLtzpJOaCD2/VR2+1hXQTnSZXVJeiTNltA==", + "version": "11.6.0", + "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.6.0.tgz", + "integrity": "sha512-mxVtVyIOTmCAkFbwIp+nCjTXJNgcz4VWkOYQro87jE2QBTydnkiYusMrRGFtzuruiGK4dDaNORk4gH049iiQuw==", "requires": { "@babel/runtime": "^7.13.10", "@emotion/babel-plugin": "^11.3.0", - "@emotion/is-prop-valid": "^1.1.0", + "@emotion/is-prop-valid": "^1.1.1", "@emotion/serialize": "^1.0.2", "@emotion/utils": "^1.0.0" }, @@ -35283,9 +35306,9 @@ } }, "common-tags": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz", - "integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw==" + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", + "integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==" }, "commondir": { "version": "1.0.1", @@ -36315,9 +36338,9 @@ "integrity": "sha512-X3bf2iTPgCAQp9wvjOQytnf5vO5rESYRXlPIVcgSbtT5OTScPcsf9eZU+B/YIkKAtYr5WeCii58BgATrNitlWg==" }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "requires": { "ms": "2.1.2" } @@ -36775,9 +36798,9 @@ } }, "devtools-protocol": { - "version": "0.0.901419", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.901419.tgz", - "integrity": "sha512-4INMPwNm9XRpBukhNbF7OB6fNTTCaI8pzy/fXg0xQzAy5h3zL1P8xT3QazgKqBrb/hAYwIBizqDBZ7GtJE74QQ==" + "version": "0.0.937139", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.937139.tgz", + "integrity": "sha512-daj+rzR3QSxsPRy5vjjthn58axO8c11j58uY0lG5vvlJk/EiOdCWOptGdkXDjtuRHr78emKq0udHCXM4trhoDQ==" }, "dicer": { "version": "0.3.0", @@ -39339,9 +39362,9 @@ } }, "gatsby-plugin-google-analytics": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-4.0.0.tgz", - "integrity": "sha512-VZAy7aVaMMIKJgcQPWXnwKZqKNY8fA4ugdx+/7lzTGSrDs1extX8SVdwA8UCHjkL799vEveRkNFXOP4Bb01khg==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/gatsby-plugin-google-analytics/-/gatsby-plugin-google-analytics-4.4.0.tgz", + "integrity": "sha512-Z+CW64zo/d1rtyMz1bJ+Ao9apsWeyak5BXNc7piO+FwE7dFdWrAyHrgGmE3YltqFUY8+PS3vmpBv9qn0ZrOSGg==", "requires": { "@babel/runtime": "^7.15.4", "minimatch": "3.0.4", @@ -39687,14 +39710,14 @@ } }, "gatsby-plugin-offline": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-offline/-/gatsby-plugin-offline-5.0.0.tgz", - "integrity": "sha512-+7poj4PzZjJc5sN77KTyjRGJaWhPeoPaPLxlvzz/x1iCTsJCPdQcPY/TeoRbzSk5BFyU94KgPejYdvBl5i/Upg==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/gatsby-plugin-offline/-/gatsby-plugin-offline-5.4.0.tgz", + "integrity": "sha512-dxFRgsKmWovjH8m0HWHao9sdcXy4X0X9SPlZETHk54ARY/wrzxVg266fA+ZVI7RPpuODBcgWoXWHuTtplfghBw==", "requires": { "@babel/runtime": "^7.15.4", "cheerio": "^1.0.0-rc.10", - "gatsby-core-utils": "^3.0.0", - "glob": "^7.1.7", + "gatsby-core-utils": "^3.4.0", + "glob": "^7.2.0", "idb-keyval": "^3.2.0", "lodash": "^4.17.21", "workbox-build": "^4.3.1" @@ -39818,17 +39841,17 @@ } }, "gatsby-core-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-3.0.0.tgz", - "integrity": "sha512-MEQAgP+/ddDTOjcfRhyZenLfr6q3nyh01muI6QTgz0qAFsbS50lZh9SbczgpuKnb6qiST1KR0OUIYTaBFXfB2g==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-3.4.0.tgz", + "integrity": "sha512-dYQpyo1BLGJzxQOXgGs1Fbj7jzGj5cKAIPYz2hz2l4Aus6skwjjaUlOjZlrWIahNHoLkx3mH0f5y6E8205T/aQ==", "requires": { "@babel/runtime": "^7.15.4", "ci-info": "2.0.0", "configstore": "^5.0.1", "file-type": "^16.5.3", "fs-extra": "^10.0.0", - "got": "^11.8.2", - "node-object-hash": "^2.3.9", + "got": "^11.8.3", + "node-object-hash": "^2.3.10", "proper-lockfile": "^4.1.2", "tmp": "^0.2.1", "xdg-basedir": "^4.0.0" @@ -39843,16 +39866,16 @@ } }, "got": { - "version": "11.8.2", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.2.tgz", - "integrity": "sha512-D0QywKgIe30ODs+fm8wMZiAcZjypcCodPNuMz5H9Mny7RJ+IjJ10BdmGW7OM7fHXP+O7r6ZwapQ/YQmMSvB0UQ==", + "version": "11.8.3", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.3.tgz", + "integrity": "sha512-7gtQ5KiPh1RtGS9/Jbv1ofDpBFuq42gyfEib+ejaRBJuj/3tQFeR5+gw57e4ipaU8c/rCjvX6fkQz2lyDlGAOg==", "requires": { "@sindresorhus/is": "^4.0.0", "@szmarczak/http-timer": "^4.0.5", "@types/cacheable-request": "^6.0.1", "@types/responselike": "^1.0.0", "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.1", + "cacheable-request": "^7.0.2", "decompress-response": "^6.0.0", "http2-wrapper": "^1.0.0-beta.5.2", "lowercase-keys": "^2.0.0", @@ -39914,9 +39937,9 @@ "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==" }, "peek-readable": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.1.tgz", - "integrity": "sha512-7qmhptnR0WMSpxT5rMHG9bW/mYSR1uqaPFj2MHvT+y/aOUu6msJijpKt5SkTDKySwg65OWG2JwTMBlgcbwMHrQ==" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.2.tgz", + "integrity": "sha512-9fMaz6zoxw9ypO1KZy5RDJgSupEtu0Q+g/OqqsVHX3rKGR8qehRLYzsFARZ4bVvdvfknKiXvuDbkMnO1g6cRpQ==" }, "responselike": { "version": "2.0.0", @@ -40349,12 +40372,12 @@ } }, "gatsby-plugin-sitemap": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gatsby-plugin-sitemap/-/gatsby-plugin-sitemap-5.0.0.tgz", - "integrity": "sha512-f2J/9xfO9+BHPwEtUzkJu5BXSPqxpoSPdtca5+3qyEA8uoaBl1jS9D2XgkzVLtsSkM4uxDLc0NKy3j0N/ZS79A==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/gatsby-plugin-sitemap/-/gatsby-plugin-sitemap-5.4.0.tgz", + "integrity": "sha512-Zwbp9BLzhjkxHm5Vvu8Kf1U+okbdVM6M6YVs7pQl3FnOMLZZ8huXHJgRnsjSyEmxENsKeelUttONBcgh38zDLA==", "requires": { "@babel/runtime": "^7.15.4", - "common-tags": "^1.8.0", + "common-tags": "^1.8.2", "minimatch": "^3.0.4", "sitemap": "^7.0.0" } @@ -40625,9 +40648,9 @@ } }, "gatsby-remark-copy-linked-files": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gatsby-remark-copy-linked-files/-/gatsby-remark-copy-linked-files-5.0.0.tgz", - "integrity": "sha512-bfqtMeb+IR1YfELoNfw+Td5BjHa9HYrgDQi/dHPj8b/ay+vexDL6TzbLuStDVzqkvSC93aboGm2k5SvKAw5aIA==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/gatsby-remark-copy-linked-files/-/gatsby-remark-copy-linked-files-5.4.0.tgz", + "integrity": "sha512-bU0jcNS5yv+WHziyxl/K3fceLyf96MQlwZzQQkGwAkfuWxEsDh15EaaT/atJbj9T0ZlccuGzXSRj7kxFlhEmPw==", "requires": { "@babel/runtime": "^7.15.4", "cheerio": "^1.0.0-rc.10", @@ -41599,9 +41622,9 @@ } }, "glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -45566,9 +45589,9 @@ } }, "node-object-hash": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-2.3.9.tgz", - "integrity": "sha512-NQt1YURrMPeQGZzW4lRbshUEF2PqxJEZYY4XJ/L+q33dI8yPYvnb7QXmwUcl1EuXluzeY4TEV+H6H0EmtI6f5g==" + "version": "2.3.10", + "resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-2.3.10.tgz", + "integrity": "sha512-jY5dPJzw6NHd/KPSfPKJ+IHoFS81/tJ43r34ZeNMXGzCOM8jwQDCD12HYayKIB6MuznrnqIYy2e891NA2g0ibA==" }, "node-releases": { "version": "1.1.75", @@ -47525,13 +47548,13 @@ } }, "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "version": "15.8.0", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.0.tgz", + "integrity": "sha512-fDGekdaHh65eI3lMi5OnErU6a8Ighg2KjcjQxO7m8VHyWjcPyj5kiOgV1LQDOOOgVy3+5FgjXvdSSX7B8/5/4g==", "requires": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", - "react-is": "^16.8.1" + "react-is": "^16.13.1" } }, "proper-lockfile": { @@ -47650,48 +47673,37 @@ } }, "puppeteer": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-10.4.0.tgz", - "integrity": "sha512-2cP8mBoqnu5gzAVpbZ0fRaobBWZM8GEUF4I1F6WbgHrKV/rz7SX8PG2wMymZgD0wo0UBlg2FBPNxlF/xlqW6+w==", + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-13.0.1.tgz", + "integrity": "sha512-wqGIx59LzYqWhYcJQphMT+ux0sgatEUbjKG0lbjJxNVqVIT3ZC5m4Bvmq2gHE3qhb63EwS+rNkql08bm4BvO0A==", "requires": { - "debug": "4.3.1", - "devtools-protocol": "0.0.901419", + "debug": "4.3.2", + "devtools-protocol": "0.0.937139", "extract-zip": "2.0.1", "https-proxy-agent": "5.0.0", - "node-fetch": "2.6.1", + "node-fetch": "2.6.5", "pkg-dir": "4.2.0", - "progress": "2.0.1", + "progress": "2.0.3", "proxy-from-env": "1.1.0", "rimraf": "3.0.2", - "tar-fs": "2.0.0", - "unbzip2-stream": "1.3.3", - "ws": "7.4.6" + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.2.3" }, "dependencies": { - "progress": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.1.tgz", - "integrity": "sha512-OE+a6vzqazc+K6LxJrX5UPyKFvGnL5CYmq2jFGNIBWHpc4QyE49/YOumcrpQFJpfejmvRtbJzgO1zPmMCqlbBg==" - }, - "tar-fs": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.0.0.tgz", - "integrity": "sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA==", + "node-fetch": { + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz", + "integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==", "requires": { - "chownr": "^1.1.1", - "mkdirp": "^0.5.1", - "pump": "^3.0.0", - "tar-stream": "^2.0.0" + "whatwg-url": "^5.0.0" } }, - "unbzip2-stream": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.3.tgz", - "integrity": "sha512-fUlAF7U9Ah1Q6EieQ4x4zLNejrRvDWUYmxXUpN3uziFYCHapjWFaCAnreY9bGgxzaMCFAPPpYNng57CypwJVhg==", - "requires": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } + "ws": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", + "requires": {} } } }, @@ -51012,6 +51024,11 @@ "ieee754": "^1.2.1" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" + }, "traverse": { "version": "0.6.6", "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", @@ -52281,6 +52298,11 @@ "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-1.1.2.tgz", "integrity": "sha512-PFMKIY+bRSXlMxVAQ+m2aw9c/ioUYfDgrYot0YUa+/xa0sakubWhSDyxAKwzymvXVdF4CZI71g06W+mqhzu6ig==" }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" + }, "webpack": { "version": "4.46.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.46.0.tgz", @@ -53228,6 +53250,15 @@ "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==" }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/docs/package.json b/docs/package.json index ef1c9ffb2021..d98e036cc5d1 100644 --- a/docs/package.json +++ b/docs/package.json @@ -6,8 +6,8 @@ "author": "", "license": "MIT", "dependencies": { - "@emotion/react": "^11.5.0", - "@emotion/styled": "^11.3.0", + "@emotion/react": "^11.7.1", + "@emotion/styled": "^11.6.0", "@mdx-js/mdx": "^1.6.22", "@mdx-js/react": "^1.6.16", "gatsby": "^2.32.13", @@ -15,19 +15,19 @@ "gatsby-plugin-canonical-urls": "^2.10.0", "gatsby-plugin-catch-links": "^2.10.0", "gatsby-plugin-emotion": "^5.0.0", - "gatsby-plugin-google-analytics": "^4.0.0", + "gatsby-plugin-google-analytics": "^4.4.0", "gatsby-plugin-manifest": "^2.12.1", "gatsby-plugin-mdx": "^2.14.0", "gatsby-plugin-netlify": "^2.11.1", "gatsby-plugin-netlify-cache": "^2.0.0", - "gatsby-plugin-offline": "^5.0.0", + "gatsby-plugin-offline": "^5.4.0", "gatsby-plugin-react-helmet": "^3.10.0", "gatsby-plugin-react-svg": "^3.1.0", "gatsby-plugin-robots-txt": "^1.6.14", "gatsby-plugin-sharp": "^3.10.2", - "gatsby-plugin-sitemap": "^5.0.0", + "gatsby-plugin-sitemap": "^5.4.0", "gatsby-remark-autolink-headers": "^2.11.0", - "gatsby-remark-copy-linked-files": "^5.0.0", + "gatsby-remark-copy-linked-files": "^5.4.0", "gatsby-remark-embedder": "^4.2.0", "gatsby-remark-external-links": "0.0.4", "gatsby-remark-images": "^3.11.1", @@ -39,8 +39,8 @@ "gatsby-transformer-yaml": "^2.11.0", "polished": "^4.1.3", "prism-react-renderer": "^1.2.1", - "prop-types": "^15.7.2", - "puppeteer": "^10.4.0", + "prop-types": "^15.8.0", + "puppeteer": "^13.0.1", "react": "^17.0.2", "react-dom": "^17.0.2", "react-headroom": "^3.2.0", diff --git a/docs/src/docs/contributing/architecture.mdx b/docs/src/docs/contributing/architecture.mdx index 1064eb74bda7..eb372bab4b4b 100644 --- a/docs/src/docs/contributing/architecture.mdx +++ b/docs/src/docs/contributing/architecture.mdx @@ -73,7 +73,7 @@ In the function `NewExecutor` we do the following: 2. init [cobra](https://github.com/spf13/cobra) commands 3. parse config file using [viper](https://github.com/spf13/viper) and merge it with command line args. -The following execution is controlled by `cobra`. If user a user executes `golangci-lint run` +The following execution is controlled by `cobra`. If a user executes `golangci-lint run` then `cobra` executes `e.runCmd`. Different `cobra` commands have different runners, e.g. a `run` command is configured in the following way: @@ -104,7 +104,7 @@ The primary execution function of the `run` command is `executeRun`. ## Load Packages Loading packages is listing all packages and their recursive dependencies for analysis. -Also, depending from enabled linters set some parsing of a source code can be performed +Also, depending on the enabled linters set some parsing of the source code can be performed at this step. Packages loading starts here: diff --git a/docs/src/docs/usage/configuration.mdx b/docs/src/docs/usage/configuration.mdx index ae0d87955bda..1a1102be34ac 100644 --- a/docs/src/docs/usage/configuration.mdx +++ b/docs/src/docs/usage/configuration.mdx @@ -12,19 +12,6 @@ To see a list of enabled by your configuration linters: golangci-lint linters ``` -## Command-Line Options - -```sh -golangci-lint run -h -{.RunHelpText} -``` - -When the `--cpu-profile-path` or `--mem-profile-path` arguments are specified, `golangci-lint` writes runtime profiling data -in the format expected by the [pprof](https://github.com/google/pprof) visualization tool. - -When the `--trace-path` argument is specified, `golangci-lint` writes runtime tracing data in the format expected by -the `go tool trace` command and visualization tool. - ## Config File GolangCI-Lint looks for config files in the following paths from the current working directory: @@ -41,13 +28,24 @@ To see which config file is being used and where it was sourced from run golangc Config options inside the file are identical to command-line options. You can configure specific linters' options only within the config file (not the command-line). -There is a [`.golangci.example.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) example -config file with all supported options, their description and default value: +There is a [`.golangci.example.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) file with all supported options, their description, and default values. +This file is a neither a working example nor recommended configuration, it's just a reference to display all the configuration options. -```yaml -{ .GolangciYamlExample } +{ .ConfigurationExample } + +## Command-Line Options + +```sh +golangci-lint run -h +{.RunHelpText} ``` +When the `--cpu-profile-path` or `--mem-profile-path` arguments are specified, `golangci-lint` writes runtime profiling data +in the format expected by the [pprof](https://github.com/google/pprof) visualization tool. + +When the `--trace-path` argument is specified, `golangci-lint` writes runtime tracing data in the format expected by +the `go tool trace` command and visualization tool. + ## Cache GolangCI-Lint stores its cache in the [default user cache directory](https://golang.org/pkg/os/#UserCacheDir). diff --git a/docs/src/docs/usage/false-positives.mdx b/docs/src/docs/usage/false-positives.mdx index 1ca6e4d8d3a5..9b0f2fba174c 100644 --- a/docs/src/docs/usage/false-positives.mdx +++ b/docs/src/docs/usage/false-positives.mdx @@ -2,17 +2,101 @@ title: False Positives --- -False positives are inevitable, but we did our best to reduce their count. For example, we have a default enabled set of [exclude patterns](/usage/configuration#command-line-options). If a false positive occurred you have the following choices: +False positives are inevitable, but we did our best to reduce their count. +For example, we have a default enabled set of [exclude patterns](/usage/configuration#command-line-options). -1. Exclude issue by text using command-line option `-e` or config option `issues.exclude`. It's helpful when you decided to ignore all issues of this type. Also, you can use `issues.exclude-rules` config option for per-path or per-linter configuration. -2. Exclude this one issue by using special comment `//nolint` (see [the section](#nolint) below). -3. Exclude issues in path by `run.skip-dirs`, `run.skip-files` or `issues.exclude-rules` config options. +If a false positive occurred, you have the several choices. -Please create [GitHub Issues here](https://github.com/golangci/golangci-lint/issues/new) if you find any false positives. We will add it to the default exclude list if it's common or we will fix underlying linter. +## Specific Linter Excludes -## Nolint +Most of the linters has a configuration, sometimes false-positives can be related to a bad configuration of a linter. +So it's recommended to check the linters configuration. -To exclude issues from all linters use `//nolint`. For example, if it's used inline (not from the beginning of the line) it excludes issues only for this line. +Otherwise, some linters have dedicated configuration to exclude or disable rules. + +An example with `staticcheck`: + +```yml +linters-settings: + staticcheck: + checks: + - all + - '-SA1000' # disable the rule SA1000 + - '-SA1004' # disable the rule SA1004 +``` + +## Exclude or Skip + +### Exclude Issue by Text + +Exclude issue by text using command-line option `-e` or config option `issues.exclude`. +It's helpful when you decided to ignore all issues of this type. +Also, you can use `issues.exclude-rules` config option for per-path or per-linter configuration. + +In the following example, all the reports that contains the sentences defined in `exclude` are excluded: + +```yml +issues: + exclude: + - "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*printf?|os\\.(Un)?Setenv). is not checked" + - "exported (type|method|function) (.+) should have comment or be unexported" + - "ST1000: at least one file in a package should have a package comment" +``` + +In the following example, all the reports from the linters (`linters`) that contains the text (`text`) are excluded: + +```yml +issues: + exclude-rules: + - linters: + - gomnd + text: "mnd: Magic number: 9" +``` + +In the following example, all the reports that contains the text (`text`) in the path (`path`) are excluded: + +```yml +issues: + exclude-rules: + - path: path/to/a/file.go + text: "string `example` has (\\d+) occurrences, make it a constant" +``` + +### Exclude Issues by Path + +Exclude issues in path by `run.skip-dirs`, `run.skip-files` or `issues.exclude-rules` config options. + +In the following example, all the reports from the linters (`linters`) that concerns the path (`path`) are excluded: + +```yml +issues: + exclude-rules: + - path: '(.+)_test\.go' + linters: + - funlen + - goconst +``` + +In the following example, all the reports related to the files (`skip-files`) are excluded: + +```yml +run: + skip-files: + - path/to/a/file.go +``` + +In the following example, all the reports related to the directories (`skip-dirs`) are excluded: + +```yml +run: + skip-dirs: + - path/to/a/dir/ +``` + +## Nolint Directive + +To exclude issues from all linters use `//nolint`. +For example, if it's used inline (not from the beginning of the line) it excludes issues only for this line. ```go var bad_name int //nolint diff --git a/docs/template_data.state b/docs/template_data.state index c287911f002c..c03a40308591 100755 --- a/docs/template_data.state +++ b/docs/template_data.state @@ -1,2 +1,2 @@ This file stores hash of website templates to trigger Netlify rebuild when something changes, e.g. new linter is added. -a1b0b356d5a4842e75df4376aa4257fe0199c7c41794ce3d6e02a954f28d64ba \ No newline at end of file +1fa49fbe817361972483cacb5d93a85faaba33c6a3d817bfcba8b8c7dd28855f \ No newline at end of file diff --git a/go.mod b/go.mod index 48b6dce56031..01a1286bffd4 100644 --- a/go.mod +++ b/go.mod @@ -6,24 +6,25 @@ require ( 4d63.com/gochecknoglobals v0.1.0 github.com/Antonboom/errname v0.1.5 github.com/Antonboom/nilnil v0.1.0 - github.com/BurntSushi/toml v0.4.1 + github.com/BurntSushi/toml v1.0.0 github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 - github.com/OpenPeeDeeP/depguard v1.0.1 + github.com/OpenPeeDeeP/depguard v1.1.0 github.com/alexkohler/prealloc v1.0.0 - github.com/ashanbrown/forbidigo v1.2.0 - github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde + github.com/ashanbrown/forbidigo v1.3.0 + github.com/ashanbrown/makezero v1.1.0 github.com/bkielbasa/cyclop v1.2.0 - github.com/blizzy78/varnamelen v0.3.0 + github.com/blizzy78/varnamelen v0.5.0 github.com/bombsimon/wsl/v3 v3.3.0 - github.com/breml/bidichk v0.1.1 + github.com/breml/bidichk v0.2.1 + github.com/breml/errchkjson v0.2.1 github.com/butuzov/ireturn v0.1.1 github.com/charithe/durationcheck v0.0.9 github.com/daixiang0/gci v0.2.9 github.com/denis-tingajkin/go-header v0.4.2 - github.com/esimonov/ifshort v1.0.3 + github.com/esimonov/ifshort v1.0.4 github.com/fatih/color v1.13.0 - github.com/fzipp/gocyclo v0.3.1 - github.com/go-critic/go-critic v0.6.1 + github.com/fzipp/gocyclo v0.4.0 + github.com/go-critic/go-critic v0.6.2 github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b github.com/gofrs/flock v0.8.1 github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 @@ -35,67 +36,71 @@ require ( github.com/golangci/misspell v0.3.5 github.com/golangci/revgrep v0.0.0-20210930125155-c22e5001d4f2 github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 - github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254 - github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5 + github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 + github.com/gostaticanalysis/forcetypeassert v0.1.0 github.com/gostaticanalysis/nilerr v0.1.1 github.com/hashicorp/go-multierror v1.1.1 github.com/jgautheron/goconst v1.5.1 github.com/jingyugao/rowserrcheck v1.1.1 github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af - github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d + github.com/julz/importas v0.1.0 github.com/kisielk/errcheck v1.6.0 - github.com/kulti/thelper v0.4.0 + github.com/kulti/thelper v0.5.0 github.com/kunwardeep/paralleltest v1.0.3 github.com/kyoh86/exportloopref v0.1.8 github.com/ldez/gomoddirectives v0.2.2 - github.com/ldez/tagliatelle v0.2.0 + github.com/ldez/tagliatelle v0.3.0 + github.com/leonklingele/grouper v1.1.0 github.com/maratori/testpackage v1.0.1 github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // v1.0 - github.com/mattn/go-colorable v0.1.11 + github.com/mattn/go-colorable v0.1.12 github.com/mbilski/exhaustivestruct v1.2.0 github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 - github.com/mgechev/revive v1.1.2 + github.com/mgechev/revive v1.1.3 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-ps v1.0.0 github.com/moricho/tparallel v0.2.1 github.com/nakabonne/nestif v0.3.1 - github.com/nishanths/exhaustive v0.2.3 + github.com/nishanths/exhaustive v0.7.11 github.com/nishanths/predeclared v0.2.1 github.com/pkg/errors v0.9.1 - github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349 + github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b github.com/prometheus/procfs v0.6.0 // indirect - github.com/quasilyte/go-ruleguard/dsl v0.3.10 + github.com/quasilyte/go-ruleguard/dsl v0.3.15 github.com/ryancurrah/gomodguard v1.2.3 github.com/ryanrolds/sqlclosecheck v0.3.0 github.com/sanposhiho/wastedassign/v2 v2.0.6 - github.com/securego/gosec/v2 v2.9.1 + github.com/securego/gosec/v2 v2.9.6 github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c - github.com/shirou/gopsutil/v3 v3.21.10 + github.com/shirou/gopsutil/v3 v3.21.12 github.com/sirupsen/logrus v1.8.1 + github.com/sivchari/containedctx v1.0.1 github.com/sivchari/tenv v1.4.7 github.com/sonatard/noctx v0.0.1 github.com/sourcegraph/go-diff v0.6.1 - github.com/spf13/cobra v1.2.1 + github.com/spf13/cobra v1.3.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.9.0 + github.com/spf13/viper v1.10.1 github.com/ssgreg/nlreturn/v2 v2.2.1 github.com/stretchr/testify v1.7.0 github.com/sylvia7788/contextcheck v1.0.4 - github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b + github.com/tdakkota/asciicheck v0.1.1 github.com/tetafro/godot v1.4.11 - github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94 + github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 github.com/tomarrell/wrapcheck/v2 v2.4.0 - github.com/tommy-muehle/go-mnd/v2 v2.4.0 + github.com/tommy-muehle/go-mnd/v2 v2.5.0 github.com/ultraware/funlen v0.0.3 github.com/ultraware/whitespace v0.0.4 github.com/uudashr/gocognit v1.0.5 github.com/valyala/quicktemplate v1.7.0 - github.com/yeya24/promlinter v0.1.0 - golang.org/x/tools v0.1.7 + github.com/yagipy/maintidx v1.0.0 + github.com/yeya24/promlinter v0.1.1-0.20210918184747-d757024714a1 + gitlab.com/bosi/decorder v0.2.1 + golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b - honnef.co/go/tools v0.2.1 - mvdan.cc/gofumpt v0.1.1 + honnef.co/go/tools v0.2.2 + mvdan.cc/gofumpt v0.2.1 mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect - mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7 + mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 ) diff --git a/go.sum b/go.sum index c26026cd2b02..fadae35e04d9 100644 --- a/go.sum +++ b/go.sum @@ -27,6 +27,10 @@ cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSU cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -35,8 +39,8 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.6.0/go.mod h1:afJwI0vaXwAG54kI7A//lP/lSPDkQORQuMkv56TxEPU= +cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -55,9 +59,10 @@ github.com/Antonboom/errname v0.1.5/go.mod h1:DugbBstvPFQbv/5uLcRRzfrNqKE9tVdVCq github.com/Antonboom/nilnil v0.1.0 h1:DLDavmg0a6G/F4Lt9t7Enrbgb3Oph6LnDE6YVsmTt74= github.com/Antonboom/nilnil v0.1.0/go.mod h1:PhHLvRPSghY5Y7mX4TW+BHZQYo1A8flE5H20D3IPZBo= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= -github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU= +github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= @@ -67,10 +72,8 @@ github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0 github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= -github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= -github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= -github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= +github.com/OpenPeeDeeP/depguard v1.1.0 h1:pjK9nLPS1FwQYGGpPxoMYpe7qACHOhAWQMQzV71i49o= +github.com/OpenPeeDeeP/depguard v1.1.0/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -85,12 +88,13 @@ github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/ashanbrown/forbidigo v1.2.0 h1:RMlEFupPCxQ1IogYOQUnIQwGEUGK8g5vAPMRyJoSxbc= -github.com/ashanbrown/forbidigo v1.2.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= -github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde h1:YOsoVXsZQPA9aOTy1g0lAJv5VzZUvwQuZqug8XPeqfM= -github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde/go.mod h1:oG9Dnez7/ESBqc4EdrdNlryeo7d0KcW1ftXHm7nU/UU= +github.com/ashanbrown/forbidigo v1.3.0 h1:VkYIwb/xxdireGAdJNZoo24O4lmnEWkactplBlWTShc= +github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= +github.com/ashanbrown/makezero v1.1.0 h1:b2FVq4dTlBpy9f6qxhbyWH+6zy56IETE9cFbBGtDqs8= +github.com/ashanbrown/makezero v1.1.0/go.mod h1:oG9Dnez7/ESBqc4EdrdNlryeo7d0KcW1ftXHm7nU/UU= github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= @@ -99,22 +103,25 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= -github.com/blizzy78/varnamelen v0.3.0 h1:80mYO7Y5ppeEefg1Jzu+NBg16iwToOQVnDnNIoWSShs= -github.com/blizzy78/varnamelen v0.3.0/go.mod h1:hbwRdBvoBqxk34XyQ6HA0UH3G0/1TKuv5AC4eaBT0Ec= +github.com/blizzy78/varnamelen v0.5.0 h1:v9LpMwxzTqAJC4lsD/jR7zWb8a66trcqhTEH4Mk6Fio= +github.com/blizzy78/varnamelen v0.5.0/go.mod h1:Mc0nLBKI1/FP0Ga4kqMOgBig0eS5QtR107JnMAb1Wuc= github.com/bombsimon/wsl/v3 v3.3.0 h1:Mka/+kRLoQJq7g2rggtgQsjuI/K5Efd87WX96EWFxjM= github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= -github.com/breml/bidichk v0.1.1 h1:Qpy8Rmgos9qdJxhka0K7ADEE5bQZX9PQUthkgggHpFM= -github.com/breml/bidichk v0.1.1/go.mod h1:zbfeitpevDUGI7V91Uzzuwrn4Vls8MoBMrwtt78jmso= +github.com/breml/bidichk v0.2.1 h1:SRNtZuLdfkxtocj+xyHXKC1Uv3jVi6EPYx+NHSTNQvE= +github.com/breml/bidichk v0.2.1/go.mod h1:zbfeitpevDUGI7V91Uzzuwrn4Vls8MoBMrwtt78jmso= +github.com/breml/errchkjson v0.2.1 h1:QCToXnY9BNngrbJoW3qfCTt3BdtbnsI6wyP/WGrxxSE= +github.com/breml/errchkjson v0.2.1/go.mod h1:jZEATw/jF69cL1iy7//Yih8yp/mXp2CBoBr9GJwCAsY= github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.9 h1:mPP4ucLrf/rKZiIG/a9IPXHGlh8p4CzgpyTy6EEutYk= github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af h1:spmv8nSH9h5oCQf40jt/ufBCt9j0/58u4G+rkeMqXGI= @@ -122,11 +129,19 @@ github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af/go.mod h1:Qjyv4H3/ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= @@ -140,6 +155,7 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/daixiang0/gci v0.2.9 h1:iwJvwQpBZmMg31w+QQ6jsyZ54KEATn6/nfARbBNW294= @@ -160,10 +176,13 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/esimonov/ifshort v1.0.3 h1:JD6x035opqGec5fZ0TLjXeROD2p5H7oLGn8MKfy9HTM= -github.com/esimonov/ifshort v1.0.3/go.mod h1:yZqNJUrNn20K8Q9n2CrjTKYyVEmX209Hgu+M1LBpeZE= +github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= +github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= +github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -173,16 +192,18 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/frankban/quicktest v1.14.0 h1:+cqqvzZV87b4adx/5ayVOaYZ2CrvM4ejQvUdBzPPUss= +github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= -github.com/fzipp/gocyclo v0.3.1 h1:A9UeX3HJSXTBzvHzhqoYVuE0eAhe+aM8XBCCwsPMZOc= -github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASxc7x3E= +github.com/fzipp/gocyclo v0.4.0 h1:IykTnjwh2YLyYkGa0y92iTTEQcnyAz0r9zOo15EbJ7k= +github.com/fzipp/gocyclo v0.4.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-critic/go-critic v0.6.1 h1:lS8B9LH/VVsvQQP7Ao5TJyQqteVKVs3E4dXiHMyubtI= -github.com/go-critic/go-critic v0.6.1/go.mod h1:SdNCfU0yF3UBjtaZGw6586/WocupMOJuiqgom5DsQxM= +github.com/go-critic/go-critic v0.6.2 h1:L5SDut1N4ZfsWZY0sH4DCrsHLHnhuuWak2wa165t9gs= +github.com/go-critic/go-critic v0.6.2/go.mod h1:td1s27kfmLpe5G/DPjlnFI7o1UCzePptwU7Az0V5iCM= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -190,7 +211,6 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= @@ -207,14 +227,12 @@ github.com/go-toolsmith/astequal v1.0.1 h1:JbSszi42Jiqu36Gnf363HWS9MTEAz67vTQLpo github.com/go-toolsmith/astequal v1.0.1/go.mod h1:4oGA3EZXTVItV/ipGiOx7NWkY5veFfcsOJVS2YxltLw= github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k= github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= -github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= -github.com/go-toolsmith/pkgload v1.0.0 h1:4DFWWMXVfbcN5So1sBNW9+yeiMqLFGl1wFLTL5R0Tgg= -github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= +github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5 h1:eD9POs68PHkwrx7hAB78z1cb6PfGq/jyWn3wJywsH1o= +github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5/go.mod h1:3NAwwmD4uY/yggRxoEjk/S00MIV3A+H7rrE3i87eYxM= github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4= github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= -github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/go-toolsmith/typep v1.0.2 h1:8xdsa1+FSIH/RhEkgnD1j2CJOy5mNllW1Q9tRiYwvlk= github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= @@ -234,6 +252,7 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -315,6 +334,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -328,11 +348,11 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= -github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254 h1:Nb2aRlC404yz7gQIfRZxX9/MLvQiqXyiBTJtgAy6yrI= -github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254/go.mod h1:M9mZEtGIsR1oDaZagNPNG9iq9n2HrhZ17dsXk73V3Lw= +github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U= +github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -347,8 +367,8 @@ github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnq github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= -github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5 h1:rx8127mFPqXXsfPSo8BwnIU97MKFZc89WHAHt8PwDVY= -github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= +github.com/gostaticanalysis/forcetypeassert v0.1.0 h1:6eUflI3DiGusXGK6X7cCcIgVCpZ2CiZ1Q7jl6ZxNV70= +github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk= github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= @@ -361,21 +381,25 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= @@ -383,22 +407,22 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= +github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -421,15 +445,16 @@ github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUB github.com/josharian/txtarfs v0.0.0-20210218200122-0702f000015a/go.mod h1:izVPOvVRsHiKkeGCT6tYBNWyDVuzj9wAaBb5R9qamfw= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d h1:XeSMXURZPtUffuWAaq90o6kLgZdgu+QA8wk4MPC8ikI= -github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= +github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= +github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -447,12 +472,14 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kulti/thelper v0.4.0 h1:2Nx7XbdbE/BYZeoip2mURKUdtHQRuy6Ug+wR7K9ywNM= -github.com/kulti/thelper v0.4.0/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= +github.com/kulti/thelper v0.5.0 h1:CiEKStgoG4K9bjf/zk3eNX0D0J2iFWzxEY+h9UXmlJg= +github.com/kulti/thelper v0.5.0/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= github.com/kunwardeep/paralleltest v1.0.3 h1:UdKIkImEAXjR1chUWLn+PNXqWUGs//7tzMeWuP7NhmI= github.com/kunwardeep/paralleltest v1.0.3/go.mod h1:vLydzomDFpk7yu5UX02RmP0H8QfRPOV/oFhWN85Mjb4= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= @@ -460,16 +487,19 @@ github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77 github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= github.com/ldez/gomoddirectives v0.2.2 h1:p9/sXuNFArS2RLc+UpYZSI4KQwGMEDWC/LbtF5OPFVg= github.com/ldez/gomoddirectives v0.2.2/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= -github.com/ldez/tagliatelle v0.2.0 h1:693V8Bf1NdShJ8eu/s84QySA0J2VWBanVBa2WwXD/Wk= -github.com/ldez/tagliatelle v0.2.0/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= +github.com/ldez/tagliatelle v0.3.0 h1:Aubm2ZsrsjIGFvdxemMPJaXrSJ5Cys6VWyTQFt9k2dI= +github.com/ldez/tagliatelle v0.3.0/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= +github.com/leonklingele/grouper v1.1.0 h1:tC2y/ygPbMFSBOs3DcyaEMKnnwH7eYKzohOtRrf0SAg= +github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -484,8 +514,8 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= @@ -500,42 +530,39 @@ github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8ceC6BxnoG8TBrhgAvRg8obzup0= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= -github.com/mgechev/revive v1.1.2 h1:MiYA/o9M7REjvOF20QN43U8OtXDDHQFKLCtJnxLGLog= -github.com/mgechev/revive v1.1.2/go.mod h1:bnXsMr+ZTH09V5rssEI+jHAZ4z+ZdyhgO/zsy3EhK+0= +github.com/mgechev/revive v1.1.3 h1:6tBZacs2/uv9UOpkBQhCtXh2NGgu2Ry97ZyjcN6uDCM= +github.com/mgechev/revive v1.1.3/go.mod h1:jMzDa13teAuv/KLeqgJw79NDe+1IT0ZO3Mht0vN1Yls= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc= github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/moricho/tparallel v0.2.1 h1:95FytivzT6rYzdJLdtfn6m1bfFJylOJK41+lgv/EHf4= github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= @@ -550,13 +577,12 @@ github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6Fx github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.2.3 h1:+ANTMqRNrqwInnP9aszg/0jDo+zbXa4x66U19Bx/oTk= -github.com/nishanths/exhaustive v0.2.3/go.mod h1:bhIX678Nx8inLM9PbpvK1yv6oGtoP8BfaIeMzgBNKvc= +github.com/nishanths/exhaustive v0.7.11 h1:xV/WU3Vdwh5BUH4N06JNUznb6d5zhRPOnlgCrpNYNKA= +github.com/nishanths/exhaustive v0.7.11/go.mod h1:gX+MP7DWMKJmNa1HfMozK+u04hQd3na9i0hyqf3/dOI= github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= github.com/nishanths/predeclared v0.2.1 h1:1TXtjmy4f3YCFjTxRd8zcFHOmoUir+gp0ESzjFzG2sw= github.com/nishanths/predeclared v0.2.1/go.mod h1:HvkGJcA3naj4lOwnFXFDkFxVtSqQMB9sbB1usJ+xjQE= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= @@ -568,10 +594,12 @@ github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ= +github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c= -github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= @@ -580,14 +608,14 @@ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6 github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -596,12 +624,15 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349 h1:Kq/3kL0k033ds3tyez5lFPrfQ74fNJ+OqCclRipubwA= -github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= +github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b h1:/BDyEJWLnDUYKGWdlNx/82qSaVu2bUok/EvPUtIGuvw= +github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -610,49 +641,59 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/pseudomuto/protoc-gen-doc v1.3.2/go.mod h1:y5+P6n3iGrbKG+9O04V5ld71in3v/bX88wUwgt+U8EA= github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= -github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= -github.com/quasilyte/go-ruleguard v0.3.13 h1:O1G41cq1jUr3cJmqp7vOUT0SokqjzmS9aESWJuIDRaY= -github.com/quasilyte/go-ruleguard v0.3.13/go.mod h1:Ul8wwdqR6kBVOCt2dipDBkE+T6vAV/iixkrKuRTN1oQ= +github.com/quasilyte/go-ruleguard v0.3.15 h1:iWYzp1z72IlXTioET0+XI6SjQdPfMGfuAiZiKznOt7g= +github.com/quasilyte/go-ruleguard v0.3.15/go.mod h1:NhuWhnlVEM1gT1A4VJHYfy9MuYSxxwHgxWoPsn9llB4= github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.10 h1:4tVlVVcBT+nNWoF+t/zrAMO13sHAqYotX1K12Gc8f8A= -github.com/quasilyte/go-ruleguard/dsl v0.3.10/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.12-0.20220101150716-969a394a9451/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.12/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.15 h1:rClYn6lk8wUV5kXnQG4JVsRQjZhSetaNtwml5wkFp5g= +github.com/quasilyte/go-ruleguard/dsl v0.3.15/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= -github.com/quasilyte/go-ruleguard/rules v0.0.0-20210428214800-545e0d2e0bf7/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= +github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= +github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3 h1:P4QPNn+TK49zJjXKERt/vyPbv/mCHB/zQ4flDYOMN+M= +github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3/go.mod h1:wSEyW6O61xRV6zb6My3HxrQ5/8ke7NE2OayqCHa3xRM= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= +github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryancurrah/gomodguard v1.2.3 h1:ww2fsjqocGCAFamzvv/b8IsRduuHHeK2MHTcTxZTQX8= github.com/ryancurrah/gomodguard v1.2.3/go.mod h1:rYbA/4Tg5c54mV1sv4sQTP5WOPBcoLtnBZ7/TEhXAbg= github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw= github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE= +github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= +github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/securego/gosec/v2 v2.9.1 h1:anHKLS/ApTYU6NZkKa/5cQqqcbKZURjvc+MtR++S4EQ= -github.com/securego/gosec/v2 v2.9.1/go.mod h1:oDcDLcatOJxkCGaCaq8lua1jTnYf6Sou4wdiJ1n4iHc= +github.com/securego/gosec/v2 v2.9.6 h1:ysfvgQBp2zmTgXQl65UkqEkYlQGbnVSRUGpCrJiiR4c= +github.com/securego/gosec/v2 v2.9.6/go.mod h1:EESY9Ywxo/Zc5NyF/qIj6Cop+4PSWM0F0OfGD7FdIXc= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= -github.com/shirou/gopsutil/v3 v3.21.10 h1:flTg1DrnV/UVrBqjLgVgDJzx6lf+91rC64/dBHmO2IA= -github.com/shirou/gopsutil/v3 v3.21.10/go.mod h1:t75NhzCZ/dYyPQjyQmrAYP6c8+LCdFANeBMdLPCNnew= +github.com/shirou/gopsutil/v3 v3.21.12 h1:VoGxEW2hpmz0Vt3wUvHIl9fquzYLNpVpgNNB7pGJimA= +github.com/shirou/gopsutil/v3 v3.21.12/go.mod h1:BToYZVTlSVlfazpDDYFnsVZLaoRG+g8ufT6fPQLdJzA= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -662,10 +703,10 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sivchari/containedctx v1.0.1 h1:fJq44cX+tD+uT5xGrsg25GwiaY61NGybQk9WWKij3Uo= +github.com/sivchari/containedctx v1.0.1/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/tenv v1.4.7 h1:FdTpgRlTue5eb5nXIYgS/lyVXSjugU8UUVDwhP1NLU8= github.com/sivchari/tenv v1.4.7/go.mod h1:5nF+bITvkebQVanjU6IuMbvIot/7ReNsUV7I5NbprB0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= @@ -673,16 +714,16 @@ github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0H github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= -github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -691,9 +732,10 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk= github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= +github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= +github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -712,8 +754,8 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/sylvia7788/contextcheck v1.0.4 h1:MsiVqROAdr0efZc/fOCt0c235qm9XJqHtWwM+2h2B04= github.com/sylvia7788/contextcheck v1.0.4/go.mod h1:vuPKJMQ7MQ91ZTqfdyreNKwZjyUg6KO+IebVyQDedZQ= -github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b h1:HxLVTlqcHhFAz3nWUcuvpH7WuOMv8LQoCWmruLfFH2U= -github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= +github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= +github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= @@ -726,8 +768,8 @@ github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= -github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94 h1:ig99OeTyDwQWhPe2iw9lwfQVF1KB3Q4fpP3X7/2VBG8= -github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= +github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro= +github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo= github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ= @@ -738,8 +780,9 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1 github.com/tomarrell/wrapcheck/v2 v2.4.0 h1:mU4H9KsqqPZUALOUbVOpjy8qNQbWLoLI9fV68/1tq30= github.com/tomarrell/wrapcheck/v2 v2.4.0/go.mod h1:68bQ/eJg55BROaRTbMjC7vuhL2OgfoG8bLp9ZyoBfyY= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= -github.com/tommy-muehle/go-mnd/v2 v2.4.0 h1:1t0f8Uiaq+fqKteUR4N9Umr6E99R+lDnLnq7PwX2PPE= -github.com/tommy-muehle/go-mnd/v2 v2.4.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= +github.com/tommy-muehle/go-mnd/v2 v2.5.0 h1:iAj0a8e6+dXSL7Liq0aXPox36FiN1dBbjA6lt9fl65s= +github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= @@ -759,8 +802,10 @@ github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8/go.mod h1:dniwbG github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yeya24/promlinter v0.1.0 h1:goWULN0jH5Yajmu/K+v1xCqIREeB+48OiJ2uu2ssc7U= -github.com/yeya24/promlinter v0.1.0/go.mod h1:rs5vtZzeBHqqMwXqFScncpCF6u06lezhZepno9AB1Oc= +github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= +github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= +github.com/yeya24/promlinter v0.1.1-0.20210918184747-d757024714a1 h1:YAaOqqMTstELMMGblt6yJ/fcOt4owSYuw3IttMnKfAM= +github.com/yeya24/promlinter v0.1.1-0.20210918184747-d757024714a1/go.mod h1:rs5vtZzeBHqqMwXqFScncpCF6u06lezhZepno9AB1Oc= github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= @@ -770,12 +815,20 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= +github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +gitlab.com/bosi/decorder v0.2.1 h1:ehqZe8hI4w7O4b1vgsDZw1YU1PE7iJXrQWFMsocbQ1w= +gitlab.com/bosi/decorder v0.2.1/go.mod h1:6C/nhLSbF6qZbYD8bRmISBwc6vcWdNsiIBkRvjJFrH0= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20200513171258-e048e166ab9c/go.mod h1:xCI7ZzBfRuGgBXyXO6yfWfDmlWd35khcWpUa4L0xI/k= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= go.mozilla.org/mozlog v0.0.0-20170222151521-4bb13139d403/go.mod h1:jHoPAGnDrCy6kaI2tAze5Prf0Nr0w/oNkROt2lw3n3o= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -811,7 +864,7 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -848,14 +901,14 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0 h1:UG21uOlmZabA4fW5i7ZX6bjw1xELEGg/ZLgZq9auk/Q= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -895,11 +948,15 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -911,11 +968,12 @@ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -980,11 +1038,13 @@ golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1000,12 +1060,21 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210915083310-ed5796bab164/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211013075003-97ac67df715c h1:taxlMj0D/1sOAuv/CbSD+MMDof2vbyPTqz5FNYKpXt8= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1027,7 +1096,6 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190307163923-6a08e3108db3/go.mod h1:25r3+/G6/xytQM8iWZKq3Hn0kr0rgFKPUNVEL/dr3z4= @@ -1037,7 +1105,6 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1054,7 +1121,6 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1110,8 +1176,6 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210104081019-d8d6ddbec6ee/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= @@ -1124,9 +1188,10 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.6/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da h1:Tno72dYE94v/7SyyIj9iBsc7OOjFu2PyNcl7yxxeZD8= +golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1154,13 +1219,18 @@ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34q google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1227,6 +1297,17 @@ google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1256,6 +1337,9 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1282,11 +1366,10 @@ gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c= gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= +gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= @@ -1310,16 +1393,16 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.2.1 h1:/EPr//+UMMXwMTkXvCCoaJDq8cpjMO80Ou+L4PDo2mY= -honnef.co/go/tools v0.2.1/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= -mvdan.cc/gofumpt v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA= -mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= +honnef.co/go/tools v0.2.2 h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk= +honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= +mvdan.cc/gofumpt v0.2.1 h1:7jakRGkQcLAJdT+C8Bwc9d0BANkVPSkHZkzNv07pJAs= +mvdan.cc/gofumpt v0.2.1/go.mod h1:a/rvZPhsNaedOJBzqRD9omnwVwHZsBdJirXHa9Gh9Ig= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7 h1:HT3e4Krq+IE44tiN36RvVEb6tvqeIdtsVSsxmNPqlFU= -mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7/go.mod h1:hBpJkZE8H/sb+VRFvw2+rBpHNsTBcvSpk61hr8mzXZE= +mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 h1:Jh3LAeMt1eGpxomyu3jVkmVZWW2MxZ1qIIV2TZ/nRio= +mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5/go.mod h1:b8RRCBm0eeiWR8cfN88xeq2G5SG3VKGO+5UPWi5FSOY= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/install.sh b/install.sh index b5bf02c03f0f..95aad9d88cfb 100644 --- a/install.sh +++ b/install.sh @@ -194,9 +194,10 @@ log_crit() { uname_os() { os=$(uname -s | tr '[:upper:]' '[:lower:]') case "$os" in - cygwin_nt*) os="windows" ;; + msys*) os="windows" ;; mingw*) os="windows" ;; - msys_nt*) os="windows" ;; + cygwin*) os="windows" ;; + win*) os="windows" ;; esac echo "$os" } diff --git a/internal/cache/cache.go b/internal/cache/cache.go index 5c3fda705815..cc6606a39c19 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -257,7 +257,7 @@ const ( // and to reduce the amount of disk activity caused by using // cache entries, used only updates the mtime if the current // mtime is more than an hour old. This heuristic eliminates -// nearly all of the mtime updates that would otherwise happen, +// nearly all the mtime updates that would otherwise happen, // while still keeping the mtimes useful for cache trimming. func (c *Cache) used(file string) error { info, err := os.Stat(file) @@ -311,7 +311,7 @@ func (c *Cache) trimSubdir(subdir string, cutoff time.Time) { // Read all directory entries from subdir before removing // any files, in case removing files invalidates the file offset // in the directory scan. Also, ignore error from f.Readdirnames, - // because we don't care about reporting the error and we still + // because we don't care about reporting the error, and we still // want to process any entries found before the error. f, err := os.Open(subdir) if err != nil { diff --git a/internal/cache/cache_test.go b/internal/cache/cache_test.go index 0efcee545b2d..1c24cdfc6276 100644 --- a/internal/cache/cache_test.go +++ b/internal/cache/cache_test.go @@ -233,7 +233,7 @@ func TestCacheTrim(t *testing.T) { t.Fatalf("second trim did work: %q -> %q", data, data2) } - // Fast forward and do another trim just before the 5 day cutoff. + // Fast-forward and do another trim just before the 5-day cutoff. // Note that because of usedQuantum the cutoff is actually 5 days + 1 hour. // We used c.Get(id) just now, so 5 days later it should still be kept. // On the other hand almost a full day has gone by since we wrote dummyID(2) diff --git a/internal/pkgcache/pkgcache.go b/internal/pkgcache/pkgcache.go index 86007d0427dd..83e607387543 100644 --- a/internal/pkgcache/pkgcache.go +++ b/internal/pkgcache/pkgcache.go @@ -26,7 +26,7 @@ const ( ) // Cache is a per-package data cache. A cached data is invalidated when -// package or it's dependencies change. +// package, or it's dependencies change. type Cache struct { lowLevelCache *cache.Cache pkgHashes sync.Map diff --git a/internal/robustio/robustio_flaky.go b/internal/robustio/robustio_flaky.go index 5963027ee117..6cc2f03d072e 100644 --- a/internal/robustio/robustio_flaky.go +++ b/internal/robustio/robustio_flaky.go @@ -53,7 +53,7 @@ func retry(f func() (err error, mayRetry bool)) error { // rename is like os.Rename, but retries ephemeral errors. // -// On windows it wraps os.Rename, which (as of 2019-06-04) uses MoveFileEx with +// On Windows it wraps os.Rename, which (as of 2019-06-04) uses MoveFileEx with // MOVEFILE_REPLACE_EXISTING. // // Windows also provides a different system call, ReplaceFile, diff --git a/pkg/commands/cache.go b/pkg/commands/cache.go index 359e2d63c7f2..ac3a3ee63fcc 100644 --- a/pkg/commands/cache.go +++ b/pkg/commands/cache.go @@ -8,6 +8,7 @@ import ( "github.com/spf13/cobra" "github.com/golangci/golangci-lint/internal/cache" + "github.com/golangci/golangci-lint/pkg/exitcodes" "github.com/golangci/golangci-lint/pkg/fsutils" "github.com/golangci/golangci-lint/pkg/logutils" ) @@ -51,7 +52,7 @@ func (e *Executor) executeCleanCache(_ *cobra.Command, args []string) { e.log.Fatalf("Failed to remove dir %s: %s", cacheDir, err) } - os.Exit(0) + os.Exit(exitcodes.Success) } func (e *Executor) executeCacheStatus(_ *cobra.Command, args []string) { @@ -66,7 +67,7 @@ func (e *Executor) executeCacheStatus(_ *cobra.Command, args []string) { fmt.Fprintf(logutils.StdOut, "Size: %s\n", fsutils.PrettifyBytesCount(cacheSizeBytes)) } - os.Exit(0) + os.Exit(exitcodes.Success) } func dirSizeBytes(path string) (int64, error) { diff --git a/pkg/commands/config.go b/pkg/commands/config.go index 0f2205970bb6..e9546d328fa6 100644 --- a/pkg/commands/config.go +++ b/pkg/commands/config.go @@ -64,5 +64,5 @@ func (e *Executor) executePathCmd(_ *cobra.Command, args []string) { } fmt.Println(usedConfigFile) - os.Exit(0) + os.Exit(exitcodes.Success) } diff --git a/pkg/commands/help.go b/pkg/commands/help.go index dc3bb47319ee..677018a6ca3b 100644 --- a/pkg/commands/help.go +++ b/pkg/commands/help.go @@ -9,6 +9,7 @@ import ( "github.com/fatih/color" "github.com/spf13/cobra" + "github.com/golangci/golangci-lint/pkg/exitcodes" "github.com/golangci/golangci-lint/pkg/lint/linter" "github.com/golangci/golangci-lint/pkg/logutils" ) @@ -53,8 +54,13 @@ func printLinterConfigs(lcs []*linter.Config) { linterDescription = linterDescription[:firstNewline] } - fmt.Fprintf(logutils.StdOut, "%s%s: %s [fast: %t, auto-fix: %t]\n", color.YellowString(lc.Name()), - altNamesStr, linterDescription, !lc.IsSlowLinter(), lc.CanAutoFix) + deprecatedMark := "" + if lc.IsDeprecated() { + deprecatedMark = " [" + color.RedString("deprecated") + "]" + } + + fmt.Fprintf(logutils.StdOut, "%s%s%s: %s [fast: %t, auto-fix: %t]\n", color.YellowString(lc.Name()), + altNamesStr, deprecatedMark, linterDescription, !lc.IsSlowLinter(), lc.CanAutoFix) } } @@ -88,5 +94,5 @@ func (e *Executor) executeLintersHelp(_ *cobra.Command, args []string) { fmt.Fprintf(logutils.StdOut, "%s: %s\n", color.YellowString(p), strings.Join(linterNames, ", ")) } - os.Exit(0) + os.Exit(exitcodes.Success) } diff --git a/pkg/commands/linters.go b/pkg/commands/linters.go index bb096942fd90..63328e4e9494 100644 --- a/pkg/commands/linters.go +++ b/pkg/commands/linters.go @@ -7,6 +7,7 @@ import ( "github.com/fatih/color" "github.com/spf13/cobra" + "github.com/golangci/golangci-lint/pkg/exitcodes" "github.com/golangci/golangci-lint/pkg/lint/linter" ) @@ -48,5 +49,5 @@ func (e *Executor) executeLinters(_ *cobra.Command, args []string) { color.Red("\nDisabled by your configuration linters:\n") printLinterConfigs(disabledLCs) - os.Exit(0) + os.Exit(exitcodes.Success) } diff --git a/pkg/commands/root.go b/pkg/commands/root.go index f90df9901ff8..141fc87f2bfd 100644 --- a/pkg/commands/root.go +++ b/pkg/commands/root.go @@ -12,13 +12,14 @@ import ( "github.com/spf13/pflag" "github.com/golangci/golangci-lint/pkg/config" + "github.com/golangci/golangci-lint/pkg/exitcodes" "github.com/golangci/golangci-lint/pkg/logutils" ) func (e *Executor) persistentPreRun(_ *cobra.Command, _ []string) { if e.cfg.Run.PrintVersion { fmt.Fprintf(logutils.StdOut, "golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date) - os.Exit(0) + os.Exit(exitcodes.Success) } runtime.GOMAXPROCS(e.cfg.Run.Concurrency) diff --git a/pkg/commands/run.go b/pkg/commands/run.go index 23a9b064acda..f75fa82f3bd3 100644 --- a/pkg/commands/run.go +++ b/pkg/commands/run.go @@ -26,6 +26,8 @@ import ( "github.com/golangci/golangci-lint/pkg/result/processors" ) +const defaultFileMode = 0644 + func getDefaultIssueExcludeHelp() string { parts := []string{"Use or not use default excludes:"} for _, ep := range config.DefaultExcludePatterns { @@ -53,7 +55,7 @@ func wh(text string) string { const defaultTimeout = time.Minute -//nolint:funlen +//nolint:funlen,gomnd func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, isFinalInit bool) { hideFlag := func(name string) { if err := fs.MarkHidden(name); err != nil { @@ -243,7 +245,7 @@ func (e *Executor) initRunConfiguration(cmd *cobra.Command) { func (e *Executor) getConfigForCommandLine() (*config.Config, error) { // We use another pflag.FlagSet here to not set `changed` flag - // on cmd.Flags() options. Otherwise string slice options will be duplicated. + // on cmd.Flags() options. Otherwise, string slice options will be duplicated. fs := pflag.NewFlagSet("config flag set", pflag.ContinueOnError) var cfg config.Config @@ -259,7 +261,7 @@ func (e *Executor) getConfigForCommandLine() (*config.Config, error) { // cfg vs e.cfg. initRootFlagSet(fs, &cfg, true) - fs.Usage = func() {} // otherwise help text will be printed twice + fs.Usage = func() {} // otherwise, help text will be printed twice if err := fs.Parse(os.Args); err != nil { if err == pflag.ErrHelp { return nil, err @@ -400,44 +402,89 @@ func (e *Executor) runAndPrint(ctx context.Context, args []string) error { return err // XXX: don't loose type } - p, err := e.createPrinter() - if err != nil { - return err + formats := strings.Split(e.cfg.Output.Format, ",") + for _, format := range formats { + out := strings.SplitN(format, ":", 2) + if len(out) < 2 { + out = append(out, "") + } + + err := e.printReports(ctx, issues, out[1], out[0]) + if err != nil { + return err + } } e.setExitCodeIfIssuesFound(issues) + e.fileCache.PrintStats(e.log) + + return nil +} + +func (e *Executor) printReports(ctx context.Context, issues []result.Issue, path, format string) error { + w, shouldClose, err := e.createWriter(path) + if err != nil { + return fmt.Errorf("can't create output for %s: %w", path, err) + } + + p, err := e.createPrinter(format, w) + if err != nil { + if file, ok := w.(io.Closer); shouldClose && ok { + _ = file.Close() + } + return err + } + if err = p.Print(ctx, issues); err != nil { + if file, ok := w.(io.Closer); shouldClose && ok { + _ = file.Close() + } return fmt.Errorf("can't print %d issues: %s", len(issues), err) } - e.fileCache.PrintStats(e.log) + if file, ok := w.(io.Closer); shouldClose && ok { + _ = file.Close() + } return nil } -func (e *Executor) createPrinter() (printers.Printer, error) { +func (e *Executor) createWriter(path string) (io.Writer, bool, error) { + if path == "" || path == "stdout" { + return logutils.StdOut, false, nil + } + if path == "stderr" { + return logutils.StdErr, false, nil + } + f, err := os.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, defaultFileMode) + if err != nil { + return nil, false, err + } + return f, true, nil +} + +func (e *Executor) createPrinter(format string, w io.Writer) (printers.Printer, error) { var p printers.Printer - format := e.cfg.Output.Format switch format { case config.OutFormatJSON: - p = printers.NewJSON(&e.reportData) + p = printers.NewJSON(&e.reportData, w) case config.OutFormatColoredLineNumber, config.OutFormatLineNumber: p = printers.NewText(e.cfg.Output.PrintIssuedLine, format == config.OutFormatColoredLineNumber, e.cfg.Output.PrintLinterName, - e.log.Child("text_printer")) + e.log.Child("text_printer"), w) case config.OutFormatTab: - p = printers.NewTab(e.cfg.Output.PrintLinterName, e.log.Child("tab_printer")) + p = printers.NewTab(e.cfg.Output.PrintLinterName, e.log.Child("tab_printer"), w) case config.OutFormatCheckstyle: - p = printers.NewCheckstyle() + p = printers.NewCheckstyle(w) case config.OutFormatCodeClimate: - p = printers.NewCodeClimate() + p = printers.NewCodeClimate(w) case config.OutFormatHTML: - p = printers.NewHTML() + p = printers.NewHTML(w) case config.OutFormatJunitXML: - p = printers.NewJunitXML() + p = printers.NewJunitXML(w) case config.OutFormatGithubActions: - p = printers.NewGithub() + p = printers.NewGithub(w) default: return nil, fmt.Errorf("unknown output format %s", format) } @@ -479,7 +526,6 @@ func (e *Executor) executeRun(_ *cobra.Command, args []string) { // to be removed when deadline is finally decommissioned func (e *Executor) setTimeoutToDeadlineIfOnlyDeadlineIsSet() { - // nolint:staticcheck deadlineValue := e.cfg.Run.Deadline if deadlineValue != 0 && e.cfg.Run.Timeout == defaultTimeout { e.cfg.Run.Timeout = deadlineValue @@ -497,7 +543,7 @@ func (e *Executor) setupExitCode(ctx context.Context) { return } - needFailOnWarnings := (os.Getenv("GL_TEST_RUN") == "1" || os.Getenv("FAIL_ON_WARNINGS") == "1") + needFailOnWarnings := os.Getenv("GL_TEST_RUN") == "1" || os.Getenv("FAIL_ON_WARNINGS") == "1" if needFailOnWarnings && len(e.reportData.Warnings) != 0 { e.exitCode = exitcodes.WarningInTest return diff --git a/pkg/config/config.go b/pkg/config/config.go index f41705c8959b..49df4e495228 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -17,7 +17,7 @@ type Config struct { InternalTest bool // Option is used only for testing golangci-lint code, don't use it } -// getConfigDir returns the directory that contains golangci config file. +// GetConfigDir returns the directory that contains golangci config file. func (c *Config) GetConfigDir() string { return c.cfgDir } diff --git a/pkg/config/linters_settings.go b/pkg/config/linters_settings.go index 840b283fec13..7e97ad3c5575 100644 --- a/pkg/config/linters_settings.go +++ b/pkg/config/linters_settings.go @@ -3,32 +3,87 @@ package config import "github.com/pkg/errors" var defaultLintersSettings = LintersSettings{ + Decorder: DecorderSettings{ + DecOrder: []string{"type", "const", "var", "func"}, + DisableDecNumCheck: true, + DisableDecOrderCheck: true, + DisableInitFuncFirstCheck: true, + }, + Dogsled: DogsledSettings{ + MaxBlankIdentifiers: 2, + }, + ErrorLint: ErrorLintSettings{ + Errorf: true, + Asserts: true, + Comparison: true, + }, + Exhaustive: ExhaustiveSettings{ + CheckGenerated: false, + DefaultSignifiesExhaustive: false, + IgnoreEnumMembers: "", + PackageScopeOnly: false, + }, + Forbidigo: ForbidigoSettings{ + ExcludeGodocExamples: true, + }, + Gocognit: GocognitSettings{ + MinComplexity: 30, + }, + Gocritic: GocriticSettings{ + SettingsPerCheck: map[string]GocriticCheckSettings{}, + }, + Godox: GodoxSettings{ + Keywords: []string{}, + }, + Godot: GodotSettings{ + Scope: "declarations", + Period: true, + }, + Gofumpt: GofumptSettings{ + LangVersion: "", + ExtraRules: false, + }, + Ifshort: IfshortSettings{ + MaxDeclLines: 1, + MaxDeclChars: 30, + }, Lll: LllSettings{ LineLength: 120, TabWidth: 1, }, - Unparam: UnparamSettings{ - Algo: "cha", + MaintIdx: MaintIdxSettings{ + Under: 20, }, Nakedret: NakedretSettings{ MaxFuncLines: 30, }, + Nestif: NestifSettings{ + MinComplexity: 5, + }, + NoLintLint: NoLintLintSettings{ + RequireExplanation: false, + AllowLeadingSpace: true, + RequireSpecific: false, + AllowUnused: false, + }, Prealloc: PreallocSettings{ Simple: true, RangeLoops: true, ForLoops: false, }, - Gocritic: GocriticSettings{ - SettingsPerCheck: map[string]GocriticCheckSettings{}, + Predeclared: PredeclaredSettings{ + Ignore: "", + Qualified: false, }, - Godox: GodoxSettings{ - Keywords: []string{}, + Testpackage: TestpackageSettings{ + SkipRegexp: `(export|internal)_test\.go`, }, - Dogsled: DogsledSettings{ - MaxBlankIdentifiers: 2, + Unparam: UnparamSettings{ + Algo: "cha", }, - Gocognit: GocognitSettings{ - MinComplexity: 30, + Varnamelen: VarnamelenSettings{ + MaxDistance: 5, + MinNameLength: 3, }, WSL: WSLSettings{ StrictAppend: true, @@ -42,50 +97,17 @@ var defaultLintersSettings = LintersSettings{ ForceExclusiveShortDeclarations: false, ForceCaseTrailingWhitespaceLimit: 0, }, - NoLintLint: NoLintLintSettings{ - RequireExplanation: false, - AllowLeadingSpace: true, - RequireSpecific: false, - AllowUnused: false, - }, - Testpackage: TestpackageSettings{ - SkipRegexp: `(export|internal)_test\.go`, - }, - Nestif: NestifSettings{ - MinComplexity: 5, - }, - Exhaustive: ExhaustiveSettings{ - CheckGenerated: false, - DefaultSignifiesExhaustive: false, - }, - Gofumpt: GofumptSettings{ - LangVersion: "", - ExtraRules: false, - }, - ErrorLint: ErrorLintSettings{ - Errorf: true, - Asserts: true, - Comparison: true, - }, - Ifshort: IfshortSettings{ - MaxDeclLines: 1, - MaxDeclChars: 30, - }, - Predeclared: PredeclaredSettings{ - Ignore: "", - Qualified: false, - }, - Forbidigo: ForbidigoSettings{ - ExcludeGodocExamples: true, - }, } type LintersSettings struct { + BiDiChk BiDiChkSettings Cyclop Cyclop + Decorder DecorderSettings Depguard DepGuardSettings Dogsled DogsledSettings Dupl DuplSettings Errcheck ErrcheckSettings + ErrChkJSON ErrChkJSONSettings ErrorLint ErrorLintSettings Exhaustive ExhaustiveSettings ExhaustiveStruct ExhaustiveStructSettings @@ -109,10 +131,12 @@ type LintersSettings struct { Gosec GoSecSettings Gosimple StaticCheckSettings Govet GovetSettings + Grouper GrouperSettings Ifshort IfshortSettings - Ireturn IreturnSettings ImportAs ImportAsSettings + Ireturn IreturnSettings Lll LllSettings + MaintIdx MaintIdxSettings Makezero MakezeroSettings Maligned MalignedSettings Misspell MisspellSettings @@ -130,9 +154,9 @@ type LintersSettings struct { Structcheck StructCheckSettings Stylecheck StaticCheckSettings Tagliatelle TagliatelleSettings + Tenv TenvSettings Testpackage TestpackageSettings Thelper ThelperSettings - Tenv TenvSettings Unparam UnparamSettings Unused StaticCheckSettings Varcheck VarCheckSettings @@ -144,6 +168,18 @@ type LintersSettings struct { Custom map[string]CustomLinterSettings } +type BiDiChkSettings struct { + LeftToRightEmbedding bool `mapstructure:"left-to-right-embedding"` + RightToLeftEmbedding bool `mapstructure:"right-to-left-embedding"` + PopDirectionalFormatting bool `mapstructure:"pop-directional-formatting"` + LeftToRightOverride bool `mapstructure:"left-to-right-override"` + RightToLeftOverride bool `mapstructure:"right-to-left-override"` + LeftToRightIsolate bool `mapstructure:"left-to-right-isolate"` + RightToLeftIsolate bool `mapstructure:"right-to-left-isolate"` + FirstStrongIsolate bool `mapstructure:"first-strong-isolate"` + PopDirectionalIsolate bool `mapstructure:"pop-directional-isolate"` +} + type Cyclop struct { MaxComplexity int `mapstructure:"max-complexity"` PackageAverage float64 `mapstructure:"package-average"` @@ -153,8 +189,17 @@ type Cyclop struct { type DepGuardSettings struct { ListType string `mapstructure:"list-type"` Packages []string - IncludeGoRoot bool `mapstructure:"include-go-root"` - PackagesWithErrorMessage map[string]string `mapstructure:"packages-with-error-message"` + IncludeGoRoot bool `mapstructure:"include-go-root"` + PackagesWithErrorMessage map[string]string `mapstructure:"packages-with-error-message"` + IgnoreFileRules []string `mapstructure:"ignore-file-rules"` + AdditionalGuards []DepGuardSettings `mapstructure:"additional-guards"` +} + +type DecorderSettings struct { + DecOrder []string `mapstructure:"dec-order"` + DisableDecNumCheck bool `mapstructure:"disable-dec-num-check"` + DisableDecOrderCheck bool `mapstructure:"disable-dec-order-check"` + DisableInitFuncFirstCheck bool `mapstructure:"disable-init-func-first-check"` } type DogsledSettings struct { @@ -175,6 +220,11 @@ type ErrcheckSettings struct { Exclude string `mapstructure:"exclude"` } +type ErrChkJSONSettings struct { + CheckErrorFreeEncoding bool `mapstructure:"check-error-free-encoding"` + ReportNoExported bool `mapstructure:"report-no-exported"` +} + type ErrorLintSettings struct { Errorf bool `mapstructure:"errorf"` Asserts bool `mapstructure:"asserts"` @@ -184,18 +234,14 @@ type ErrorLintSettings struct { type ExhaustiveSettings struct { CheckGenerated bool `mapstructure:"check-generated"` DefaultSignifiesExhaustive bool `mapstructure:"default-signifies-exhaustive"` - IgnorePattern string `mapstructure:"ignore-pattern"` + IgnoreEnumMembers string `mapstructure:"ignore-enum-members"` + PackageScopeOnly bool `mapstructure:"package-scope-only"` } type ExhaustiveStructSettings struct { StructPatterns []string `mapstructure:"struct-patterns"` } -type IreturnSettings struct { - Allow []string `mapstructure:"allow"` - Reject []string `mapstructure:"reject"` -} - type ForbidigoSettings struct { Forbid []string `mapstructure:"forbid"` ExcludeGodocExamples bool `mapstructure:"exclude-godoc-examples"` @@ -233,6 +279,7 @@ type GodotSettings struct { Scope string `mapstructure:"scope"` Exclude []string `mapstructure:"exclude"` Capital bool `mapstructure:"capital"` + Period bool `mapstructure:"period"` // Deprecated: use `Scope` instead CheckAll bool `mapstructure:"check-all"` @@ -266,7 +313,11 @@ type GoLintSettings struct { } type GoMndSettings struct { - Settings map[string]map[string]interface{} + Settings map[string]map[string]interface{} // Deprecated + Checks []string `mapstructure:"checks"` + IgnoredNumbers []string `mapstructure:"ignored-numbers"` + IgnoredFiles []string `mapstructure:"ignored-files"` + IgnoredFunctions []string `mapstructure:"ignored-functions"` } type GoModDirectivesSettings struct { @@ -326,14 +377,26 @@ func (cfg GovetSettings) Validate() error { return nil } +type GrouperSettings struct { + ConstRequireSingleConst bool `mapstructure:"const-require-single-const"` + ConstRequireGrouping bool `mapstructure:"const-require-grouping"` + ImportRequireSingleImport bool `mapstructure:"import-require-single-import"` + ImportRequireGrouping bool `mapstructure:"import-require-grouping"` + TypeRequireSingleType bool `mapstructure:"type-require-single-type"` + TypeRequireGrouping bool `mapstructure:"type-require-grouping"` + VarRequireSingleVar bool `mapstructure:"var-require-single-var"` + VarRequireGrouping bool `mapstructure:"var-require-grouping"` +} + type IfshortSettings struct { MaxDeclLines int `mapstructure:"max-decl-lines"` MaxDeclChars int `mapstructure:"max-decl-chars"` } type ImportAsSettings struct { - Alias []ImportAsAlias - NoUnaliased bool `mapstructure:"no-unaliased"` + Alias []ImportAsAlias + NoUnaliased bool `mapstructure:"no-unaliased"` + NoExtraAliases bool `mapstructure:"no-extra-aliases"` } type ImportAsAlias struct { @@ -341,11 +404,20 @@ type ImportAsAlias struct { Alias string } +type IreturnSettings struct { + Allow []string `mapstructure:"allow"` + Reject []string `mapstructure:"reject"` +} + type LllSettings struct { LineLength int `mapstructure:"line-length"` TabWidth int `mapstructure:"tab-width"` } +type MaintIdxSettings struct { + Under int `mapstructure:"under"` +} + type MakezeroSettings struct { Always bool } @@ -482,11 +554,15 @@ type VarCheckSettings struct { } type VarnamelenSettings struct { - MaxDistance int `mapstructure:"max-distance"` - MinNameLength int `mapstructure:"min-name-length"` - CheckReceiver bool `mapstructure:"check-receiver"` - CheckReturn bool `mapstructure:"check-return"` - IgnoreNames []string `mapstructure:"ignore-names"` + MaxDistance int `mapstructure:"max-distance"` + MinNameLength int `mapstructure:"min-name-length"` + CheckReceiver bool `mapstructure:"check-receiver"` + CheckReturn bool `mapstructure:"check-return"` + IgnoreNames []string `mapstructure:"ignore-names"` + IgnoreTypeAssertOk bool `mapstructure:"ignore-type-assert-ok"` + IgnoreMapIndexOk bool `mapstructure:"ignore-map-index-ok"` + IgnoreChanRecvOk bool `mapstructure:"ignore-chan-recv-ok"` + IgnoreDecls []string `mapstructure:"ignore-decls"` } type WhitespaceSettings struct { @@ -496,6 +572,7 @@ type WhitespaceSettings struct { type WrapcheckSettings struct { IgnoreSigs []string `mapstructure:"ignoreSigs"` + IgnoreSigRegexps []string `mapstructure:"ignoreSigRegexps"` IgnorePackageGlobs []string `mapstructure:"ignorePackageGlobs"` } diff --git a/pkg/config/reader.go b/pkg/config/reader.go index 9f368341b292..e8824c75335b 100644 --- a/pkg/config/reader.go +++ b/pkg/config/reader.go @@ -10,6 +10,7 @@ import ( "github.com/mitchellh/go-homedir" "github.com/spf13/viper" + "github.com/golangci/golangci-lint/pkg/exitcodes" "github.com/golangci/golangci-lint/pkg/fsutils" "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/sliceutil" @@ -87,7 +88,7 @@ func (r *FileReader) parseConfig() error { if r.cfg.InternalTest { // just for testing purposes: to detect config file usage fmt.Fprintln(logutils.StdOut, "test") - os.Exit(0) + os.Exit(exitcodes.Success) } return nil diff --git a/pkg/exitcodes/exitcodes.go b/pkg/exitcodes/exitcodes.go index 536f9036142d..83331dbe7b48 100644 --- a/pkg/exitcodes/exitcodes.go +++ b/pkg/exitcodes/exitcodes.go @@ -1,14 +1,14 @@ package exitcodes const ( - Success = 0 - IssuesFound = 1 - WarningInTest = 2 - Failure = 3 - Timeout = 4 - NoGoFiles = 5 - NoConfigFileDetected = 6 - ErrorWasLogged = 7 + Success = iota + IssuesFound + WarningInTest + Failure + Timeout + NoGoFiles + NoConfigFileDetected + ErrorWasLogged ) type ExitError struct { @@ -30,5 +30,3 @@ var ( Code: Failure, } ) - -// 1 diff --git a/pkg/golinters/bidichk.go b/pkg/golinters/bidichk.go index e1b467cc14bd..44215b7e90cf 100644 --- a/pkg/golinters/bidichk.go +++ b/pkg/golinters/bidichk.go @@ -1,17 +1,59 @@ package golinters import ( + "strings" + "github.com/breml/bidichk/pkg/bidichk" "golang.org/x/tools/go/analysis" + "github.com/golangci/golangci-lint/pkg/config" "github.com/golangci/golangci-lint/pkg/golinters/goanalysis" ) -func NewBiDiChkFuncName() *goanalysis.Linter { +func NewBiDiChkFuncName(cfg *config.BiDiChkSettings) *goanalysis.Linter { + a := bidichk.NewAnalyzer() + + cfgMap := map[string]map[string]interface{}{} + if cfg != nil { + var opts []string + + if cfg.LeftToRightEmbedding { + opts = append(opts, "LEFT-TO-RIGHT-EMBEDDING") + } + if cfg.RightToLeftEmbedding { + opts = append(opts, "RIGHT-TO-LEFT-EMBEDDING") + } + if cfg.PopDirectionalFormatting { + opts = append(opts, "POP-DIRECTIONAL-FORMATTING") + } + if cfg.LeftToRightOverride { + opts = append(opts, "LEFT-TO-RIGHT-OVERRIDE") + } + if cfg.RightToLeftOverride { + opts = append(opts, "RIGHT-TO-LEFT-OVERRIDE") + } + if cfg.LeftToRightIsolate { + opts = append(opts, "LEFT-TO-RIGHT-ISOLATE") + } + if cfg.RightToLeftIsolate { + opts = append(opts, "RIGHT-TO-LEFT-ISOLATE") + } + if cfg.FirstStrongIsolate { + opts = append(opts, "FIRST-STRONG-ISOLATE") + } + if cfg.PopDirectionalIsolate { + opts = append(opts, "POP-DIRECTIONAL-ISOLATE") + } + + cfgMap[a.Name] = map[string]interface{}{ + "disallowed-runes": strings.Join(opts, ","), + } + } + return goanalysis.NewLinter( "bidichk", "Checks for dangerous unicode character sequences", - []*analysis.Analyzer{bidichk.Analyzer}, - nil, + []*analysis.Analyzer{a}, + cfgMap, ).WithLoadMode(goanalysis.LoadModeSyntax) } diff --git a/pkg/golinters/containedctx.go b/pkg/golinters/containedctx.go new file mode 100644 index 000000000000..8592eef1f9ae --- /dev/null +++ b/pkg/golinters/containedctx.go @@ -0,0 +1,19 @@ +package golinters + +import ( + "github.com/sivchari/containedctx" + "golang.org/x/tools/go/analysis" + + "github.com/golangci/golangci-lint/pkg/golinters/goanalysis" +) + +func NewContainedCtx() *goanalysis.Linter { + a := containedctx.Analyzer + + return goanalysis.NewLinter( + a.Name, + a.Doc, + []*analysis.Analyzer{a}, + nil, + ).WithLoadMode(goanalysis.LoadModeSyntax) +} diff --git a/pkg/golinters/decorder.go b/pkg/golinters/decorder.go new file mode 100644 index 000000000000..672f206ea35c --- /dev/null +++ b/pkg/golinters/decorder.go @@ -0,0 +1,38 @@ +package golinters + +import ( + "strings" + + "gitlab.com/bosi/decorder" + "golang.org/x/tools/go/analysis" + + "github.com/golangci/golangci-lint/pkg/config" + "github.com/golangci/golangci-lint/pkg/golinters/goanalysis" +) + +func NewDecorder(settings *config.DecorderSettings) *goanalysis.Linter { + a := decorder.Analyzer + + analyzers := []*analysis.Analyzer{a} + + // disable all rules/checks by default + cfg := map[string]interface{}{ + "disable-dec-num-check": true, + "disable-dec-order-check": true, + "disable-init-func-first-check": true, + } + + if settings != nil { + cfg["dec-order"] = strings.Join(settings.DecOrder, ",") + cfg["disable-dec-num-check"] = settings.DisableDecNumCheck + cfg["disable-dec-order-check"] = settings.DisableDecOrderCheck + cfg["disable-init-func-first-check"] = settings.DisableInitFuncFirstCheck + } + + return goanalysis.NewLinter( + a.Name, + a.Doc, + analyzers, + map[string]map[string]interface{}{a.Name: cfg}, + ).WithLoadMode(goanalysis.LoadModeSyntax) +} diff --git a/pkg/golinters/depguard.go b/pkg/golinters/depguard.go index aa372e9568c0..dd6a79772072 100644 --- a/pkg/golinters/depguard.go +++ b/pkg/golinters/depguard.go @@ -9,99 +9,42 @@ import ( "golang.org/x/tools/go/analysis" "golang.org/x/tools/go/loader" //nolint:staticcheck // require changes in github.com/OpenPeeDeeP/depguard + "github.com/golangci/golangci-lint/pkg/config" "github.com/golangci/golangci-lint/pkg/golinters/goanalysis" "github.com/golangci/golangci-lint/pkg/lint/linter" "github.com/golangci/golangci-lint/pkg/result" ) -func setDepguardListType(dg *depguard.Depguard, lintCtx *linter.Context) error { - listType := lintCtx.Settings().Depguard.ListType - var found bool - dg.ListType, found = depguard.StringToListType[strings.ToLower(listType)] - if !found { - if listType != "" { - return fmt.Errorf("unsure what list type %s is", listType) - } - dg.ListType = depguard.LTBlacklist - } - - return nil -} - -func setupDepguardPackages(dg *depguard.Depguard, lintCtx *linter.Context) { - if dg.ListType == depguard.LTBlacklist { - // if the list type was a blacklist the packages with error messages should - // be included in the blacklist package list - - noMessagePackages := make(map[string]bool) - for _, pkg := range dg.Packages { - noMessagePackages[pkg] = true - } - - for pkg := range lintCtx.Settings().Depguard.PackagesWithErrorMessage { - if _, ok := noMessagePackages[pkg]; !ok { - dg.Packages = append(dg.Packages, pkg) - } - } - } -} +const depguardLinterName = "depguard" func NewDepguard() *goanalysis.Linter { - const linterName = "depguard" var mu sync.Mutex var resIssues []goanalysis.Issue analyzer := &analysis.Analyzer{ - Name: linterName, + Name: depguardLinterName, Doc: goanalysis.TheOnlyanalyzerDoc, } return goanalysis.NewLinter( - linterName, + depguardLinterName, "Go linter that checks if package imports are in a list of acceptable packages", []*analysis.Analyzer{analyzer}, nil, ).WithContextSetter(func(lintCtx *linter.Context) { - dgSettings := &lintCtx.Settings().Depguard - analyzer.Run = func(pass *analysis.Pass) (interface{}, error) { - prog := goanalysis.MakeFakeLoaderProgram(pass) - dg := &depguard.Depguard{ - Packages: dgSettings.Packages, - IncludeGoRoot: dgSettings.IncludeGoRoot, - } - if err := setDepguardListType(dg, lintCtx); err != nil { - return nil, err - } - setupDepguardPackages(dg, lintCtx) + dg, err := newDepGuard(&lintCtx.Settings().Depguard) - loadConfig := &loader.Config{ - Cwd: "", // fallbacked to os.Getcwd - Build: nil, // fallbacked to build.Default - } - issues, err := dg.Run(loadConfig, prog) + analyzer.Run = func(pass *analysis.Pass) (interface{}, error) { if err != nil { return nil, err } - if len(issues) == 0 { - return nil, nil - } - msgSuffix := "is in the blacklist" - if dg.ListType == depguard.LTWhitelist { - msgSuffix = "is not in the whitelist" - } - res := make([]goanalysis.Issue, 0, len(issues)) - for _, i := range issues { - userSuppliedMsgSuffix := dgSettings.PackagesWithErrorMessage[i.PackageName] - if userSuppliedMsgSuffix != "" { - userSuppliedMsgSuffix = ": " + userSuppliedMsgSuffix - } - res = append(res, goanalysis.NewIssue(&result.Issue{ - Pos: i.Position, - Text: fmt.Sprintf("%s %s%s", formatCode(i.PackageName, lintCtx.Cfg), msgSuffix, userSuppliedMsgSuffix), - FromLinter: linterName, - }, pass)) + + issues, errRun := dg.run(pass) + if errRun != nil { + return nil, errRun } + mu.Lock() - resIssues = append(resIssues, res...) + resIssues = append(resIssues, issues...) mu.Unlock() return nil, nil @@ -110,3 +53,140 @@ func NewDepguard() *goanalysis.Linter { return resIssues }).WithLoadMode(goanalysis.LoadModeTypesInfo) } + +type depGuard struct { + loadConfig *loader.Config + guardians []*guardian +} + +func newDepGuard(settings *config.DepGuardSettings) (*depGuard, error) { + ps, err := newGuardian(settings) + if err != nil { + return nil, err + } + + d := &depGuard{ + loadConfig: &loader.Config{ + Cwd: "", // fallbacked to os.Getcwd + Build: nil, // fallbacked to build.Default + }, + guardians: []*guardian{ps}, + } + + for _, additional := range settings.AdditionalGuards { + add := additional + ps, err = newGuardian(&add) + if err != nil { + return nil, err + } + + d.guardians = append(d.guardians, ps) + } + + return d, nil +} + +func (d depGuard) run(pass *analysis.Pass) ([]goanalysis.Issue, error) { + prog := goanalysis.MakeFakeLoaderProgram(pass) + + var resIssues []goanalysis.Issue + for _, g := range d.guardians { + issues, errRun := g.run(d.loadConfig, prog, pass) + if errRun != nil { + return nil, errRun + } + + resIssues = append(resIssues, issues...) + } + + return resIssues, nil +} + +type guardian struct { + *depguard.Depguard + pkgsWithErrorMessage map[string]string +} + +func newGuardian(settings *config.DepGuardSettings) (*guardian, error) { + dg := &depguard.Depguard{ + Packages: settings.Packages, + IncludeGoRoot: settings.IncludeGoRoot, + IgnoreFileRules: settings.IgnoreFileRules, + } + + var err error + dg.ListType, err = getDepGuardListType(settings.ListType) + if err != nil { + return nil, err + } + + // if the list type was a blacklist the packages with error messages should be included in the blacklist package list + if dg.ListType == depguard.LTBlacklist { + noMessagePackages := make(map[string]bool) + for _, pkg := range dg.Packages { + noMessagePackages[pkg] = true + } + + for pkg := range settings.PackagesWithErrorMessage { + if _, ok := noMessagePackages[pkg]; !ok { + dg.Packages = append(dg.Packages, pkg) + } + } + } + + return &guardian{ + Depguard: dg, + pkgsWithErrorMessage: settings.PackagesWithErrorMessage, + }, nil +} + +func (g guardian) run(loadConfig *loader.Config, prog *loader.Program, pass *analysis.Pass) ([]goanalysis.Issue, error) { + issues, err := g.Run(loadConfig, prog) + if err != nil { + return nil, err + } + + res := make([]goanalysis.Issue, 0, len(issues)) + + for _, issue := range issues { + res = append(res, + goanalysis.NewIssue(&result.Issue{ + Pos: issue.Position, + Text: g.createMsg(issue.PackageName), + FromLinter: depguardLinterName, + }, pass), + ) + } + + return res, nil +} + +func (g guardian) createMsg(pkgName string) string { + msgSuffix := "is in the blacklist" + if g.ListType == depguard.LTWhitelist { + msgSuffix = "is not in the whitelist" + } + + var userSuppliedMsgSuffix string + if g.pkgsWithErrorMessage != nil { + userSuppliedMsgSuffix = g.pkgsWithErrorMessage[pkgName] + if userSuppliedMsgSuffix != "" { + userSuppliedMsgSuffix = ": " + userSuppliedMsgSuffix + } + } + + return fmt.Sprintf("%s %s%s", formatCode(pkgName, nil), msgSuffix, userSuppliedMsgSuffix) +} + +func getDepGuardListType(listType string) (depguard.ListType, error) { + if listType == "" { + return depguard.LTBlacklist, nil + } + + listT, found := depguard.StringToListType[strings.ToLower(listType)] + if !found { + return depguard.LTBlacklist, fmt.Errorf("unsure what list type %s is", listType) + } + + return listT, nil +} diff --git a/pkg/golinters/errchkjson.go b/pkg/golinters/errchkjson.go new file mode 100644 index 000000000000..6dc2b20046ff --- /dev/null +++ b/pkg/golinters/errchkjson.go @@ -0,0 +1,33 @@ +package golinters + +import ( + "github.com/breml/errchkjson" + "golang.org/x/tools/go/analysis" + + "github.com/golangci/golangci-lint/pkg/config" + "github.com/golangci/golangci-lint/pkg/golinters/goanalysis" +) + +func NewErrChkJSONFuncName(cfg *config.ErrChkJSONSettings) *goanalysis.Linter { + a := errchkjson.NewAnalyzer() + + cfgMap := map[string]map[string]interface{}{} + cfgMap[a.Name] = map[string]interface{}{ + "omit-safe": true, + } + if cfg != nil { + cfgMap[a.Name] = map[string]interface{}{ + "omit-safe": !cfg.CheckErrorFreeEncoding, + "report-no-exported": cfg.ReportNoExported, + } + } + + return goanalysis.NewLinter( + "errchkjson", + "Checks types passed to the json encoding functions. "+ + "Reports unsupported types and optionally reports occations, "+ + "where the check for the returned error can be omitted.", + []*analysis.Analyzer{a}, + cfgMap, + ).WithLoadMode(goanalysis.LoadModeTypesInfo) +} diff --git a/pkg/golinters/exhaustive.go b/pkg/golinters/exhaustive.go index 9acee6a80641..ea264687df38 100644 --- a/pkg/golinters/exhaustive.go +++ b/pkg/golinters/exhaustive.go @@ -17,7 +17,8 @@ func NewExhaustive(settings *config.ExhaustiveSettings) *goanalysis.Linter { a.Name: { exhaustive.CheckGeneratedFlag: settings.CheckGenerated, exhaustive.DefaultSignifiesExhaustiveFlag: settings.DefaultSignifiesExhaustive, - exhaustive.IgnorePatternFlag: settings.IgnorePattern, + exhaustive.IgnoreEnumMembersFlag: settings.IgnoreEnumMembers, + exhaustive.PackageScopeOnlyFlag: settings.PackageScopeOnly, }, } } diff --git a/pkg/golinters/goanalysis/runner.go b/pkg/golinters/goanalysis/runner.go index 8b460d16b424..c52998fbf943 100644 --- a/pkg/golinters/goanalysis/runner.go +++ b/pkg/golinters/goanalysis/runner.go @@ -185,7 +185,7 @@ func (r *runner) prepareAnalysis(pkgs []*packages.Package, // and analysis-to-analysis (horizontal) dependencies. // This place is memory-intensive: e.g. Istio project has 120k total actions. - // Therefore optimize it carefully. + // Therefore, optimize it carefully. markedActions := make(map[actKey]struct{}, len(analyzers)*len(pkgs)) for _, a := range analyzers { for _, pkg := range pkgs { diff --git a/pkg/golinters/goanalysis/runner_action.go b/pkg/golinters/goanalysis/runner_action.go index 96c613e83e84..50ea64c5cb1a 100644 --- a/pkg/golinters/goanalysis/runner_action.go +++ b/pkg/golinters/goanalysis/runner_action.go @@ -179,8 +179,8 @@ func (act *action) analyze() { if act.pkg.IllTyped { // It looks like there should be !pass.Analyzer.RunDespiteErrors - // but govet's cgocall crashes on it. Govet itself contains !pass.Analyzer.RunDespiteErrors condition here - // but it exit before it if packages.Load have failed. + // but govet's cgocall crashes on it. Govet itself contains !pass.Analyzer.RunDespiteErrors condition here, + // but it exits before it if packages.Load have failed. act.err = errors.Wrap(&IllTypedError{Pkg: act.pkg}, "analysis skipped") } else { startedAt = time.Now() diff --git a/pkg/golinters/goanalysis/runner_loadingpackage.go b/pkg/golinters/goanalysis/runner_loadingpackage.go index f9a43f3f5cf1..1ac6b83e30de 100644 --- a/pkg/golinters/goanalysis/runner_loadingpackage.go +++ b/pkg/golinters/goanalysis/runner_loadingpackage.go @@ -61,7 +61,7 @@ func (lp *loadingPackage) analyze(loadMode LoadMode, loadSem chan struct{}) { if err := lp.loadWithFacts(loadMode); err != nil { werr := errors.Wrapf(err, "failed to load package %s", lp.pkg.Name) // Don't need to write error to errCh, it will be extracted and reported on another layer. - // Unblock depending actions and propagate error. + // Unblock depending on actions and propagate error. for _, act := range lp.actions { close(act.analysisDoneCh) act.err = werr @@ -269,16 +269,16 @@ func (lp *loadingPackage) loadImportedPackageWithFacts(loadMode LoadMode) error // Load package from export data if loadMode >= LoadModeTypesInfo { if err := lp.loadFromExportData(); err != nil { - // We asked Go to give us up to date export data, yet + // We asked Go to give us up-to-date export data, yet // we can't load it. There must be something wrong. // // Attempt loading from source. This should fail (because // otherwise there would be export data); we just want to // get the compile errors. If loading from source succeeds - // we discard the result, anyway. Otherwise we'll fail + // we discard the result, anyway. Otherwise, we'll fail // when trying to reload from export data later. - // Otherwise it panics because uses already existing (from exported data) types. + // Otherwise, it panics because uses already existing (from exported data) types. pkg.Types = types.NewPackage(pkg.PkgPath, pkg.Name) if srcErr := lp.loadFromSource(loadMode); srcErr != nil { return srcErr @@ -311,7 +311,7 @@ func (lp *loadingPackage) loadImportedPackageWithFacts(loadMode LoadMode) error // Cached facts loading failed: analyze later the action from source. To perform // the analysis we need to load the package from source code. - // Otherwise it panics because uses already existing (from exported data) types. + // Otherwise, it panics because uses already existing (from exported data) types. if loadMode >= LoadModeTypesInfo { pkg.Types = types.NewPackage(pkg.PkgPath, pkg.Name) } diff --git a/pkg/golinters/gochecknoglobals.go b/pkg/golinters/gochecknoglobals.go index 804865cfcbaf..0732bc6aa4dd 100644 --- a/pkg/golinters/gochecknoglobals.go +++ b/pkg/golinters/gochecknoglobals.go @@ -10,9 +10,9 @@ import ( func NewGochecknoglobals() *goanalysis.Linter { gochecknoglobals := checknoglobals.Analyzer() - // gochecknoglobals only lints test files if the `-t` flag is passed so we + // gochecknoglobals only lints test files if the `-t` flag is passed, so we // pass the `t` flag as true to the analyzer before running it. This can be - // turned of by using the regular golangci-lint flags such as `--tests` or + // turned off by using the regular golangci-lint flags such as `--tests` or // `--skip-files`. linterConfig := map[string]map[string]interface{}{ gochecknoglobals.Name: { diff --git a/pkg/golinters/gocritic.go b/pkg/golinters/gocritic.go index 0c32a8562023..ea3a3cbcbe8b 100644 --- a/pkg/golinters/gocritic.go +++ b/pkg/golinters/gocritic.go @@ -48,8 +48,9 @@ Dynamic rules are written declaratively with AST patterns, filters, report messa } linterCtx.SetPackageInfo(pass.TypesInfo, pass.Pkg) - var res []goanalysis.Issue pkgIssues := runGocriticOnPackage(linterCtx, enabledCheckers, pass.Files) + res := make([]goanalysis.Issue, 0, len(pkgIssues)) + for i := range pkgIssues { res = append(res, goanalysis.NewIssue(&pkgIssues[i], pass)) } @@ -119,7 +120,6 @@ func configureCheckerInfo( // but the file parsers (TOML, YAML, JSON) don't create the same representation for raw type. // then we have to convert value types into the expected value types. // Maybe in the future, this kind of conversion will be done in go-critic itself. -//nolint:exhaustive // only 3 types (int, bool, and string) are supported by CheckerParam.Value func normalizeCheckerParamsValue(lintCtx *linter.Context, p interface{}) interface{} { rv := reflect.ValueOf(p) switch rv.Type().Kind() { @@ -180,11 +180,23 @@ func runGocriticOnFile(ctx *gocriticlinter.Context, f *ast.File, checkers []*goc // as read-only structure, so no copying is required. for _, warn := range c.Check(f) { pos := ctx.FileSet.Position(warn.Node.Pos()) - res = append(res, result.Issue{ + issue := result.Issue{ Pos: pos, Text: fmt.Sprintf("%s: %s", c.Info.Name, warn.Text), FromLinter: gocriticName, - }) + } + + if warn.HasQuickFix() { + issue.Replacement = &result.Replacement{ + Inline: &result.InlineFix{ + StartCol: pos.Column - 1, + Length: int(warn.Node.End() - warn.Node.Pos()), + NewString: string(warn.Suggestion.Replacement), + }, + } + } + + res = append(res, issue) } } diff --git a/pkg/golinters/godot.go b/pkg/golinters/godot.go index 6252458909eb..cd5b2a43ef02 100644 --- a/pkg/golinters/godot.go +++ b/pkg/golinters/godot.go @@ -31,13 +31,14 @@ func NewGodot() *goanalysis.Linter { settings := godot.Settings{ Scope: godot.Scope(cfg.Scope), Exclude: cfg.Exclude, - Period: true, + Period: cfg.Period, Capital: cfg.Capital, } // Convert deprecated setting - if cfg.CheckAll { // nolint: staticcheck - settings.Scope = godot.TopLevelScope + // todo(butuzov): remove on v2 release + if cfg.CheckAll { // nolint:staticcheck + settings.Scope = godot.AllScope } if settings.Scope == "" { diff --git a/pkg/golinters/gomnd.go b/pkg/golinters/gomnd.go index f7e71b7dae43..15d84b48bfdd 100644 --- a/pkg/golinters/gomnd.go +++ b/pkg/golinters/gomnd.go @@ -8,20 +8,38 @@ import ( "github.com/golangci/golangci-lint/pkg/golinters/goanalysis" ) -func NewGoMND(cfg *config.Config) *goanalysis.Linter { - analyzers := []*analysis.Analyzer{ - mnd.Analyzer, - } - +func NewGoMND(settings *config.GoMndSettings) *goanalysis.Linter { var linterCfg map[string]map[string]interface{} - if cfg != nil { - linterCfg = cfg.LintersSettings.Gomnd.Settings + + if settings != nil { + // TODO(ldez) For compatibility only, must be drop in v2. + if len(settings.Settings) > 0 { + linterCfg = settings.Settings + } else { + cfg := make(map[string]interface{}) + if len(settings.Checks) > 0 { + cfg["checks"] = settings.Checks + } + if len(settings.IgnoredNumbers) > 0 { + cfg["ignored-numbers"] = settings.IgnoredNumbers + } + if len(settings.IgnoredFiles) > 0 { + cfg["ignored-files"] = settings.IgnoredFiles + } + if len(settings.IgnoredFunctions) > 0 { + cfg["ignored-functions"] = settings.IgnoredFunctions + } + + linterCfg = map[string]map[string]interface{}{ + "mnd": cfg, + } + } } return goanalysis.NewLinter( "gomnd", "An analyzer to detect magic numbers.", - analyzers, + []*analysis.Analyzer{mnd.Analyzer}, linterCfg, ).WithLoadMode(goanalysis.LoadModeSyntax) } diff --git a/pkg/golinters/gosec.go b/pkg/golinters/gosec.go index 9610b3e836b1..b220c30273e7 100644 --- a/pkg/golinters/gosec.go +++ b/pkg/golinters/gosec.go @@ -40,7 +40,7 @@ func NewGosec(settings *config.GoSecSettings) *goanalysis.Linter { } } - ruleDefinitions := rules.Generate(filters...) + ruleDefinitions := rules.Generate(false, filters...) logger := log.New(io.Discard, "", 0) @@ -55,8 +55,8 @@ func NewGosec(settings *config.GoSecSettings) *goanalysis.Linter { nil, ).WithContextSetter(func(lintCtx *linter.Context) { analyzer.Run = func(pass *analysis.Pass) (interface{}, error) { - gosecAnalyzer := gosec.NewAnalyzer(gasConfig, true, settings.ExcludeGenerated, logger) - gosecAnalyzer.LoadRules(ruleDefinitions.Builders()) + gosecAnalyzer := gosec.NewAnalyzer(gasConfig, true, settings.ExcludeGenerated, false, logger) + gosecAnalyzer.LoadRules(ruleDefinitions.RulesInfo()) pkg := &packages.Package{ Fset: pass.Fset, diff --git a/pkg/golinters/grouper.go b/pkg/golinters/grouper.go new file mode 100644 index 000000000000..e8c1340e4b7e --- /dev/null +++ b/pkg/golinters/grouper.go @@ -0,0 +1,32 @@ +package golinters + +import ( + grouper "github.com/leonklingele/grouper/pkg/analyzer" + "golang.org/x/tools/go/analysis" + + "github.com/golangci/golangci-lint/pkg/config" + "github.com/golangci/golangci-lint/pkg/golinters/goanalysis" +) + +func NewGrouper(settings *config.GrouperSettings) *goanalysis.Linter { + linterCfg := map[string]map[string]interface{}{} + if settings != nil { + linterCfg["grouper"] = map[string]interface{}{ + "const-require-single-const": settings.ConstRequireSingleConst, + "const-require-grouping": settings.ConstRequireGrouping, + "import-require-single-import": settings.ImportRequireSingleImport, + "import-require-grouping": settings.ImportRequireGrouping, + "type-require-single-type": settings.TypeRequireSingleType, + "type-require-grouping": settings.TypeRequireGrouping, + "var-require-single-var": settings.VarRequireSingleVar, + "var-require-grouping": settings.VarRequireGrouping, + } + } + + return goanalysis.NewLinter( + "grouper", + "An analyzer to analyze expression groups.", + []*analysis.Analyzer{grouper.New()}, + linterCfg, + ).WithLoadMode(goanalysis.LoadModeSyntax) +} diff --git a/pkg/golinters/importas.go b/pkg/golinters/importas.go index 523aa257b43a..d1f042829571 100644 --- a/pkg/golinters/importas.go +++ b/pkg/golinters/importas.go @@ -28,8 +28,11 @@ func NewImportAs(settings *config.ImportAsSettings) *goanalysis.Linter { lintCtx.Log.Infof("importas settings found, but no aliases listed. List aliases under alias: key.") // nolint: misspell } - err := analyzer.Flags.Set("no-unaliased", strconv.FormatBool(settings.NoUnaliased)) - if err != nil { + if err := analyzer.Flags.Set("no-unaliased", strconv.FormatBool(settings.NoUnaliased)); err != nil { + lintCtx.Log.Errorf("failed to parse configuration: %v", err) + } + + if err := analyzer.Flags.Set("no-extra-aliases", strconv.FormatBool(settings.NoExtraAliases)); err != nil { lintCtx.Log.Errorf("failed to parse configuration: %v", err) } diff --git a/pkg/golinters/lll.go b/pkg/golinters/lll.go index 5f26e91ddbf5..e0a9de63c675 100644 --- a/pkg/golinters/lll.go +++ b/pkg/golinters/lll.go @@ -51,11 +51,11 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r // we can return this line as a long line instead of returning an error. // The reason for this change is that this case might happen with autogenerated files // The go-bindata tool for instance might generate a file with a very long line. - // In this case, as it's a auto generated file, the warning returned by lll will + // In this case, as it's an auto generated file, the warning returned by lll will // be ignored. // But if we return a linter error here, and this error happens for an autogenerated // file the error will be discarded (fine), but all the subsequent errors for lll will - // be discarded for other files and we'll miss legit error. + // be discarded for other files, and we'll miss legit error. res = append(res, result.Issue{ Pos: token.Position{ Filename: filename, diff --git a/pkg/golinters/maintidx.go b/pkg/golinters/maintidx.go new file mode 100644 index 000000000000..2b02b948f47e --- /dev/null +++ b/pkg/golinters/maintidx.go @@ -0,0 +1,32 @@ +package golinters + +import ( + "github.com/yagipy/maintidx" + "golang.org/x/tools/go/analysis" + + "github.com/golangci/golangci-lint/pkg/config" + "github.com/golangci/golangci-lint/pkg/golinters/goanalysis" +) + +func NewMaintIdx(cfg *config.MaintIdxSettings) *goanalysis.Linter { + analyzer := maintidx.Analyzer + + cfgMap := map[string]map[string]interface{}{ + analyzer.Name: {"under": 20}, + } + + if cfg != nil { + cfgMap[analyzer.Name] = map[string]interface{}{ + "under": cfg.Under, + } + } + + return goanalysis.NewLinter( + analyzer.Name, + analyzer.Doc, + []*analysis.Analyzer{ + analyzer, + }, + cfgMap, + ).WithLoadMode(goanalysis.LoadModeSyntax) +} diff --git a/pkg/golinters/nolintlint/nolintlint.go b/pkg/golinters/nolintlint/nolintlint.go index 4466cab41f36..064fd61a6100 100644 --- a/pkg/golinters/nolintlint/nolintlint.go +++ b/pkg/golinters/nolintlint/nolintlint.go @@ -199,7 +199,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) { position: pos, } - // check for, report and eliminate leading spaces so we can check for other issues + // check for, report and eliminate leading spaces, so we can check for other issues if len(leadingSpace) > 0 { removeWhitespace := &result.Replacement{ Inline: &result.InlineFix{ @@ -281,7 +281,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) { if (l.needs&NeedsExplanation) != 0 && (explanation == "" || strings.TrimSpace(explanation) == "//") { needsExplanation := len(linters) == 0 // if no linters are mentioned, we must have explanation - // otherwise, check if we are excluding all of the mentioned linters + // otherwise, check if we are excluding all the mentioned linters for _, ll := range linters { if !l.excludeByLinter[ll] { // if a linter does require explanation needsExplanation = true diff --git a/pkg/golinters/revive.go b/pkg/golinters/revive.go index 061c9b475d88..5b1e0c091b66 100644 --- a/pkg/golinters/revive.go +++ b/pkg/golinters/revive.go @@ -146,7 +146,7 @@ func reviveToIssue(pass *analysis.Pass, object *jsonObject) goanalysis.Issue { } // This function mimics the GetConfig function of revive. -// This allow to get default values and right types. +// This allows to get default values and right types. // https://github.com/golangci/golangci-lint/issues/1745 // https://github.com/mgechev/revive/blob/389ba853b0b3587f0c3b71b5f0c61ea4e23928ec/config/config.go#L155 func getReviveConfig(cfg *config.ReviveSettings) (*lint.Config, error) { @@ -162,7 +162,7 @@ func getReviveConfig(cfg *config.ReviveSettings) (*lint.Config, error) { } conf = &lint.Config{} - _, err = toml.DecodeReader(buf, conf) + _, err = toml.NewDecoder(buf).Decode(conf) if err != nil { return nil, errors.Wrap(err, "failed to decode configuration") } @@ -235,7 +235,7 @@ func safeTomlSlice(r []interface{}) []interface{} { } // This element is not exported by revive, so we need copy the code. -// Extracted from https://github.com/mgechev/revive/blob/389ba853b0b3587f0c3b71b5f0c61ea4e23928ec/config/config.go#L15 +// Extracted from https://github.com/mgechev/revive/blob/111721be475b73b5a2304dd01ccbcab587357fca/config/config.go#L15 var defaultRules = []lint.Rule{ &rule.VarDeclarationsRule{}, &rule.PackageCommentsRule{}, @@ -257,12 +257,83 @@ var defaultRules = []lint.Rule{ &rule.ContextAsArgumentRule{}, } +var allRules = append([]lint.Rule{ + &rule.ArgumentsLimitRule{}, + &rule.CyclomaticRule{}, + &rule.FileHeaderRule{}, + &rule.EmptyBlockRule{}, + &rule.SuperfluousElseRule{}, + &rule.ConfusingNamingRule{}, + &rule.GetReturnRule{}, + &rule.ModifiesParamRule{}, + &rule.ConfusingResultsRule{}, + &rule.DeepExitRule{}, + &rule.UnusedParamRule{}, + &rule.UnreachableCodeRule{}, + &rule.AddConstantRule{}, + &rule.FlagParamRule{}, + &rule.UnnecessaryStmtRule{}, + &rule.StructTagRule{}, + &rule.ModifiesValRecRule{}, + &rule.ConstantLogicalExprRule{}, + &rule.BoolLiteralRule{}, + &rule.RedefinesBuiltinIDRule{}, + &rule.ImportsBlacklistRule{}, + &rule.FunctionResultsLimitRule{}, + &rule.MaxPublicStructsRule{}, + &rule.RangeValInClosureRule{}, + &rule.RangeValAddress{}, + &rule.WaitGroupByValueRule{}, + &rule.AtomicRule{}, + &rule.EmptyLinesRule{}, + &rule.LineLengthLimitRule{}, + &rule.CallToGCRule{}, + &rule.DuplicatedImportsRule{}, + &rule.ImportShadowingRule{}, + &rule.BareReturnRule{}, + &rule.UnusedReceiverRule{}, + &rule.UnhandledErrorRule{}, + &rule.CognitiveComplexityRule{}, + &rule.StringOfIntRule{}, + &rule.StringFormatRule{}, + &rule.EarlyReturnRule{}, + &rule.UnconditionalRecursionRule{}, + &rule.IdenticalBranchesRule{}, + &rule.DeferRule{}, + &rule.UnexportedNamingRule{}, + &rule.FunctionLength{}, + &rule.NestedStructs{}, + &rule.IfReturnRule{}, + &rule.UselessBreak{}, + &rule.TimeEqualRule{}, + &rule.BannedCharsRule{}, + &rule.OptimizeOperandsOrderRule{}, +}, defaultRules...) + // This element is not exported by revive, so we need copy the code. -// Extracted from https://github.com/mgechev/revive/blob/389ba853b0b3587f0c3b71b5f0c61ea4e23928ec/config/config.go#L133 +// Extracted from https://github.com/mgechev/revive/blob/111721be475b73b5a2304dd01ccbcab587357fca/config/config.go#L143 func normalizeConfig(cfg *lint.Config) { + const defaultConfidence = 0.8 if cfg.Confidence == 0 { - cfg.Confidence = 0.8 + cfg.Confidence = defaultConfidence + } + + if len(cfg.Rules) == 0 { + cfg.Rules = map[string]lint.RuleConfig{} } + if cfg.EnableAllRules { + // Add to the configuration all rules not yet present in it + for _, rule := range allRules { + ruleName := rule.Name() + _, alreadyInConf := cfg.Rules[ruleName] + if alreadyInConf { + continue + } + // Add the rule with an empty conf for + cfg.Rules[ruleName] = lint.RuleConfig{} + } + } + severity := cfg.Severity if severity != "" { for k, v := range cfg.Rules { @@ -281,7 +352,7 @@ func normalizeConfig(cfg *lint.Config) { } // This element is not exported by revive, so we need copy the code. -// Extracted from https://github.com/mgechev/revive/blob/389ba853b0b3587f0c3b71b5f0c61ea4e23928ec/config/config.go#L182 +// Extracted from https://github.com/mgechev/revive/blob/111721be475b73b5a2304dd01ccbcab587357fca/config/config.go#L210 func defaultConfig() *lint.Config { defaultConfig := lint.Config{ Confidence: 0.0, diff --git a/pkg/golinters/rowerrcheck.go b/pkg/golinters/rowserrcheck.go similarity index 100% rename from pkg/golinters/rowerrcheck.go rename to pkg/golinters/rowserrcheck.go diff --git a/pkg/golinters/varnamelen.go b/pkg/golinters/varnamelen.go index 168c881c4bb3..3effdf0e1bf6 100644 --- a/pkg/golinters/varnamelen.go +++ b/pkg/golinters/varnamelen.go @@ -17,9 +17,13 @@ func NewVarnamelen(settings *config.VarnamelenSettings) *goanalysis.Linter { cfg := map[string]map[string]interface{}{} if settings != nil { vnlCfg := map[string]interface{}{ - "checkReceiver": strconv.FormatBool(settings.CheckReceiver), - "checkReturn": strconv.FormatBool(settings.CheckReturn), - "ignoreNames": strings.Join(settings.IgnoreNames, ","), + "checkReceiver": strconv.FormatBool(settings.CheckReceiver), + "checkReturn": strconv.FormatBool(settings.CheckReturn), + "ignoreNames": strings.Join(settings.IgnoreNames, ","), + "ignoreTypeAssertOk": strconv.FormatBool(settings.IgnoreTypeAssertOk), + "ignoreMapIndexOk": strconv.FormatBool(settings.IgnoreMapIndexOk), + "ignoreChanRecvOk": strconv.FormatBool(settings.IgnoreChanRecvOk), + "ignoreDecls": strings.Join(settings.IgnoreDecls, ","), } if settings.MaxDistance > 0 { diff --git a/pkg/golinters/wrapcheck.go b/pkg/golinters/wrapcheck.go index 5eaf085d7435..c52bcb740f42 100644 --- a/pkg/golinters/wrapcheck.go +++ b/pkg/golinters/wrapcheck.go @@ -16,6 +16,9 @@ func NewWrapcheck(settings *config.WrapcheckSettings) *goanalysis.Linter { if len(settings.IgnoreSigs) != 0 { cfg.IgnoreSigs = settings.IgnoreSigs } + if len(settings.IgnoreSigRegexps) != 0 { + cfg.IgnoreSigRegexps = settings.IgnoreSigRegexps + } if len(settings.IgnorePackageGlobs) != 0 { cfg.IgnorePackageGlobs = settings.IgnorePackageGlobs } diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go index 7d5695747cb0..cf6a0f8d4b6f 100644 --- a/pkg/lint/lintersdb/manager.go +++ b/pkg/lint/lintersdb/manager.go @@ -100,18 +100,25 @@ func enableLinterConfigs(lcs []*linter.Config, isEnabled func(lc *linter.Config) //nolint:funlen func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { + var bidichkCfg *config.BiDiChkSettings var cyclopCfg *config.Cyclop + var decorderCfg *config.DecorderSettings + var errchkjsonCfg *config.ErrChkJSONSettings var errorlintCfg *config.ErrorLintSettings var exhaustiveCfg *config.ExhaustiveSettings var exhaustiveStructCfg *config.ExhaustiveStructSettings var goModDirectivesCfg *config.GoModDirectivesSettings + var goMndCfg *config.GoMndSettings var gosecCfg *config.GoSecSettings var gosimpleCfg *config.StaticCheckSettings var govetCfg *config.GovetSettings + var grouperCfg *config.GrouperSettings var ifshortCfg *config.IfshortSettings var importAsCfg *config.ImportAsSettings var ireturnCfg *config.IreturnSettings + var maintIdxCfg *config.MaintIdxSettings var nilNilCfg *config.NilNilSettings + var nlreturnCfg *config.NlreturnSettings var predeclaredCfg *config.PredeclaredSettings var reviveCfg *config.ReviveSettings var staticcheckCfg *config.StaticCheckSettings @@ -123,21 +130,27 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { var unusedCfg *config.StaticCheckSettings var varnamelenCfg *config.VarnamelenSettings var wrapcheckCfg *config.WrapcheckSettings - var nlreturnCfg *config.NlreturnSettings if m.cfg != nil { + bidichkCfg = &m.cfg.LintersSettings.BiDiChk cyclopCfg = &m.cfg.LintersSettings.Cyclop + errchkjsonCfg = &m.cfg.LintersSettings.ErrChkJSON + decorderCfg = &m.cfg.LintersSettings.Decorder errorlintCfg = &m.cfg.LintersSettings.ErrorLint exhaustiveCfg = &m.cfg.LintersSettings.Exhaustive exhaustiveStructCfg = &m.cfg.LintersSettings.ExhaustiveStruct goModDirectivesCfg = &m.cfg.LintersSettings.GoModDirectives + goMndCfg = &m.cfg.LintersSettings.Gomnd gosecCfg = &m.cfg.LintersSettings.Gosec gosimpleCfg = &m.cfg.LintersSettings.Gosimple govetCfg = &m.cfg.LintersSettings.Govet + grouperCfg = &m.cfg.LintersSettings.Grouper ifshortCfg = &m.cfg.LintersSettings.Ifshort importAsCfg = &m.cfg.LintersSettings.ImportAs ireturnCfg = &m.cfg.LintersSettings.Ireturn + maintIdxCfg = &m.cfg.LintersSettings.MaintIdx nilNilCfg = &m.cfg.LintersSettings.NilNil + nlreturnCfg = &m.cfg.LintersSettings.Nlreturn predeclaredCfg = &m.cfg.LintersSettings.Predeclared reviveCfg = &m.cfg.LintersSettings.Revive staticcheckCfg = &m.cfg.LintersSettings.Staticcheck @@ -149,403 +162,508 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config { unusedCfg = &m.cfg.LintersSettings.Unused varnamelenCfg = &m.cfg.LintersSettings.Varnamelen wrapcheckCfg = &m.cfg.LintersSettings.Wrapcheck - nlreturnCfg = &m.cfg.LintersSettings.Nlreturn } const megacheckName = "megacheck" + // The linters are sorted in the alphabetical order (case-insensitive). + // When a new linter is added the version in `WithSince(...)` must be the next minor version of golangci-lint. lcs := []*linter.Config{ - linter.NewConfig(golinters.NewGovet(govetCfg)). - WithSince("v1.0.0"). - WithLoadForGoAnalysis(). - WithPresets(linter.PresetBugs, linter.PresetMetaLinter). - WithAlternativeNames("vet", "vetshadow"). - WithURL("https://golang.org/cmd/vet/"), + linter.NewConfig(golinters.NewAsciicheck()). + WithSince("v1.26.0"). + WithPresets(linter.PresetBugs, linter.PresetStyle). + WithURL("https://github.com/tdakkota/asciicheck"), + + linter.NewConfig(golinters.NewBiDiChkFuncName(bidichkCfg)). + WithSince("1.43.0"). + WithPresets(linter.PresetBugs). + WithURL("https://github.com/breml/bidichk"), + linter.NewConfig(golinters.NewBodyclose()). WithSince("v1.18.0"). WithLoadForGoAnalysis(). WithPresets(linter.PresetPerformance, linter.PresetBugs). WithURL("https://github.com/timakin/bodyclose"), - linter.NewConfig(golinters.NewNoctx()). - WithSince("v1.28.0"). + + linter.NewConfig(golinters.NewContainedCtx()). + WithSince("1.44.0"). + WithPresets(linter.PresetStyle). + WithURL("https://github.com/sivchari/containedctx"), + + linter.NewConfig(golinters.NewContextCheck()). + WithSince("v1.43.0"). + WithPresets(linter.PresetBugs). WithLoadForGoAnalysis(). - WithPresets(linter.PresetPerformance, linter.PresetBugs). - WithURL("https://github.com/sonatard/noctx"), - linter.NewConfig(golinters.NewErrcheck()). - WithSince("v1.0.0"). + WithURL("https://github.com/sylvia7788/contextcheck"), + + linter.NewConfig(golinters.NewCyclop(cyclopCfg)). + WithSince("v1.37.0"). WithLoadForGoAnalysis(). - WithPresets(linter.PresetBugs, linter.PresetError). - WithURL("https://github.com/kisielk/errcheck"), - linter.NewConfig(golinters.NewGolint()). + WithPresets(linter.PresetComplexity). + WithURL("https://github.com/bkielbasa/cyclop"), + + linter.NewConfig(golinters.NewDecorder(decorderCfg)). + WithSince("v1.44.0"). + WithPresets(linter.PresetFormatting, linter.PresetStyle). + WithURL("https://gitlab.com/bosi/decorder"), + + linter.NewConfig(golinters.NewDeadcode()). WithSince("v1.0.0"). WithLoadForGoAnalysis(). - WithPresets(linter.PresetStyle). - WithURL("https://github.com/golang/lint"). - Deprecated("The repository of the linter has been archived by the owner.", "v1.41.0", "revive"), - linter.NewConfig(golinters.NewRowsErrCheck()). - WithSince("v1.23.0"). + WithPresets(linter.PresetUnused). + WithURL("https://github.com/remyoudompheng/go-misc/tree/master/deadcode"), + + linter.NewConfig(golinters.NewDepguard()). + WithSince("v1.4.0"). WithLoadForGoAnalysis(). - WithPresets(linter.PresetBugs, linter.PresetSQL). - WithURL("https://github.com/jingyugao/rowserrcheck"), + WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule). + WithURL("https://github.com/OpenPeeDeeP/depguard"), - linter.NewConfig(golinters.NewStaticcheck(staticcheckCfg)). + linter.NewConfig(golinters.NewDogsled()). + WithSince("v1.19.0"). + WithPresets(linter.PresetStyle). + WithURL("https://github.com/alexkohler/dogsled"), + + linter.NewConfig(golinters.NewDupl()). WithSince("v1.0.0"). + WithPresets(linter.PresetStyle). + WithURL("https://github.com/mibk/dupl"), + + linter.NewConfig(golinters.NewDurationCheck()). + WithSince("v1.37.0"). + WithPresets(linter.PresetBugs). WithLoadForGoAnalysis(). - WithPresets(linter.PresetBugs, linter.PresetMetaLinter). - WithAlternativeNames(megacheckName). - WithURL("https://staticcheck.io/"), - linter.NewConfig(golinters.NewUnused(unusedCfg)). - WithSince("v1.20.0"). - WithLoadForGoAnalysis(). - WithPresets(linter.PresetUnused). - WithAlternativeNames(megacheckName). - ConsiderSlow(). - WithChangeTypes(). - WithURL("https://github.com/dominikh/go-tools/tree/master/unused"), - linter.NewConfig(golinters.NewGosimple(gosimpleCfg)). - WithSince("v1.20.0"). + WithURL("https://github.com/charithe/durationcheck"), + + linter.NewConfig(golinters.NewErrcheck()). + WithSince("v1.0.0"). WithLoadForGoAnalysis(). - WithPresets(linter.PresetStyle). - WithAlternativeNames(megacheckName). - WithURL("https://github.com/dominikh/go-tools/tree/master/simple"), + WithPresets(linter.PresetBugs, linter.PresetError). + WithURL("https://github.com/kisielk/errcheck"), - linter.NewConfig(golinters.NewStylecheck(stylecheckCfg)). - WithSince("v1.20.0"). + linter.NewConfig(golinters.NewErrChkJSONFuncName(errchkjsonCfg)). + WithSince("1.44.0"). + WithPresets(linter.PresetBugs). WithLoadForGoAnalysis(). + WithURL("https://github.com/breml/errchkjson"), + + linter.NewConfig(golinters.NewErrName()). + WithSince("v1.42.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/dominikh/go-tools/tree/master/stylecheck"), - linter.NewConfig(golinters.NewGosec(gosecCfg)). - WithSince("v1.0.0"). WithLoadForGoAnalysis(). + WithURL("https://github.com/Antonboom/errname"), + + linter.NewConfig(golinters.NewErrorLint(errorlintCfg)). + WithSince("v1.32.0"). + WithPresets(linter.PresetBugs, linter.PresetError). + WithLoadForGoAnalysis(). + WithURL("https://github.com/polyfloyd/go-errorlint"), + + linter.NewConfig(golinters.NewExhaustive(exhaustiveCfg)). + WithSince(" v1.28.0"). WithPresets(linter.PresetBugs). - WithURL("https://github.com/securego/gosec"). - WithAlternativeNames("gas"), - linter.NewConfig(golinters.NewStructcheck()). - WithSince("v1.0.0"). WithLoadForGoAnalysis(). - WithPresets(linter.PresetUnused). - WithURL("https://github.com/opennota/check"), - linter.NewConfig(golinters.NewVarcheck()). - WithSince("v1.0.0"). + WithURL("https://github.com/nishanths/exhaustive"), + + linter.NewConfig(golinters.NewExhaustiveStruct(exhaustiveStructCfg)). + WithSince("v1.32.0"). + WithPresets(linter.PresetStyle, linter.PresetTest). WithLoadForGoAnalysis(). - WithPresets(linter.PresetUnused). - WithURL("https://github.com/opennota/check"), - linter.NewConfig(golinters.NewInterfacer()). - WithSince("v1.0.0"). + WithURL("https://github.com/mbilski/exhaustivestruct"), + + linter.NewConfig(golinters.NewExportLoopRef()). + WithSince("v1.28.0"). + WithPresets(linter.PresetBugs). WithLoadForGoAnalysis(). + WithURL("https://github.com/kyoh86/exportloopref"), + + linter.NewConfig(golinters.NewForbidigo()). + WithSince("v1.34.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/mvdan/interfacer"). - Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", ""), - linter.NewConfig(golinters.NewUnconvert()). - WithSince("v1.0.0"). - WithLoadForGoAnalysis(). + WithURL("https://github.com/ashanbrown/forbidigo"), + + linter.NewConfig(golinters.NewForceTypeAssert()). + WithSince("v1.38.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/mdempsky/unconvert"), - linter.NewConfig(golinters.NewIneffassign()). - WithSince("v1.0.0"). - WithPresets(linter.PresetUnused). - WithURL("https://github.com/gordonklaus/ineffassign"), - linter.NewConfig(golinters.NewDupl()). - WithSince("v1.0.0"). + WithURL("https://github.com/gostaticanalysis/forcetypeassert"), + + linter.NewConfig(golinters.NewFunlen()). + WithSince("v1.18.0"). + WithPresets(linter.PresetComplexity). + WithURL("https://github.com/ultraware/funlen"), + + linter.NewConfig(golinters.NewGci()). + WithSince("v1.30.0"). + WithPresets(linter.PresetFormatting, linter.PresetImport). + WithAutoFix(). + WithURL("https://github.com/daixiang0/gci"), + + linter.NewConfig(golinters.NewGochecknoglobals()). + WithSince("v1.12.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/mibk/dupl"), + WithURL("https://github.com/leighmcculloch/gochecknoglobals"), + + linter.NewConfig(golinters.NewGochecknoinits()). + WithSince("v1.12.0"). + WithPresets(linter.PresetStyle). + WithURL("https://github.com/leighmcculloch/gochecknoinits"), + + linter.NewConfig(golinters.NewGocognit()). + WithSince("v1.20.0"). + WithPresets(linter.PresetComplexity). + WithURL("https://github.com/uudashr/gocognit"), + linter.NewConfig(golinters.NewGoconst()). WithSince("v1.0.0"). WithPresets(linter.PresetStyle). WithURL("https://github.com/jgautheron/goconst"), - linter.NewConfig(golinters.NewDeadcode()). - WithSince("v1.0.0"). + + linter.NewConfig(golinters.NewGocritic()). + WithSince("v1.12.0"). + WithPresets(linter.PresetStyle, linter.PresetMetaLinter). WithLoadForGoAnalysis(). - WithPresets(linter.PresetUnused). - WithURL("https://github.com/remyoudompheng/go-misc/tree/master/deadcode"), + WithURL("https://github.com/go-critic/go-critic"), + linter.NewConfig(golinters.NewGocyclo()). WithSince("v1.0.0"). WithPresets(linter.PresetComplexity). WithURL("https://github.com/fzipp/gocyclo"), - linter.NewConfig(golinters.NewCyclop(cyclopCfg)). - WithSince("v1.37.0"). - WithLoadForGoAnalysis(). - WithPresets(linter.PresetComplexity). - WithURL("https://github.com/bkielbasa/cyclop"), - linter.NewConfig(golinters.NewGocognit()). - WithSince("v1.20.0"). - WithPresets(linter.PresetComplexity). - WithURL("https://github.com/uudashr/gocognit"), - linter.NewConfig(golinters.NewTypecheck()). - WithSince("v1.3.0"). - WithLoadForGoAnalysis(). - WithPresets(linter.PresetBugs). - WithURL(""), - linter.NewConfig(golinters.NewAsciicheck()). + + linter.NewConfig(golinters.NewGodot()). + WithSince("v1.25.0"). + WithPresets(linter.PresetStyle, linter.PresetComment). + WithAutoFix(). + WithURL("https://github.com/tetafro/godot"), + + linter.NewConfig(golinters.NewGodox()). + WithSince("v1.19.0"). + WithPresets(linter.PresetStyle, linter.PresetComment). + WithURL("https://github.com/matoous/godox"), + + linter.NewConfig(golinters.NewGoerr113()). WithSince("v1.26.0"). - WithPresets(linter.PresetBugs, linter.PresetStyle). - WithURL("https://github.com/tdakkota/asciicheck"), + WithPresets(linter.PresetStyle, linter.PresetError). + WithLoadForGoAnalysis(). + WithURL("https://github.com/Djarvur/go-err113"), linter.NewConfig(golinters.NewGofmt()). WithSince("v1.0.0"). WithPresets(linter.PresetFormatting). WithAutoFix(). WithURL("https://golang.org/cmd/gofmt/"), + linter.NewConfig(golinters.NewGofumpt()). WithSince("v1.28.0"). WithPresets(linter.PresetFormatting). WithAutoFix(). WithURL("https://github.com/mvdan/gofumpt"), - linter.NewConfig(golinters.NewGoimports()). - WithSince("v1.20.0"). - WithPresets(linter.PresetFormatting, linter.PresetImport). - WithAutoFix(). - WithURL("https://godoc.org/golang.org/x/tools/cmd/goimports"), + linter.NewConfig(golinters.NewGoHeader()). WithSince("v1.28.0"). WithPresets(linter.PresetStyle). WithURL("https://github.com/denis-tingajkin/go-header"), - linter.NewConfig(golinters.NewGci()). - WithSince("v1.30.0"). + + linter.NewConfig(golinters.NewGoimports()). + WithSince("v1.20.0"). WithPresets(linter.PresetFormatting, linter.PresetImport). WithAutoFix(). - WithURL("https://github.com/daixiang0/gci"), - linter.NewConfig(golinters.NewMaligned()). + WithURL("https://godoc.org/golang.org/x/tools/cmd/goimports"), + + linter.NewConfig(golinters.NewGolint()). WithSince("v1.0.0"). WithLoadForGoAnalysis(). - WithPresets(linter.PresetPerformance). - WithURL("https://github.com/mdempsky/maligned"). - Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", "govet 'fieldalignment'"), - linter.NewConfig(golinters.NewDepguard()). - WithSince("v1.4.0"). - WithLoadForGoAnalysis(). - WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule). - WithURL("https://github.com/OpenPeeDeeP/depguard"), - linter.NewConfig(golinters.NewMisspell()). - WithSince("v1.8.0"). - WithPresets(linter.PresetStyle, linter.PresetComment). - WithAutoFix(). - WithURL("https://github.com/client9/misspell"), - linter.NewConfig(golinters.NewLLL()). - WithSince("v1.8.0"). - WithPresets(linter.PresetStyle), - linter.NewConfig(golinters.NewUnparam()). - WithSince("v1.9.0"). - WithPresets(linter.PresetUnused). - WithLoadForGoAnalysis(). - WithURL("https://github.com/mvdan/unparam"), - linter.NewConfig(golinters.NewDogsled()). - WithSince("v1.19.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/alexkohler/dogsled"), - linter.NewConfig(golinters.NewNakedret()). - WithSince("v1.19.0"). + WithURL("https://github.com/golang/lint"). + Deprecated("The repository of the linter has been archived by the owner.", "v1.41.0", "revive"), + + linter.NewConfig(golinters.NewGoMND(goMndCfg)). + WithSince("v1.22.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/alexkohler/nakedret"), - linter.NewConfig(golinters.NewPrealloc()). - WithSince("v1.19.0"). - WithPresets(linter.PresetPerformance). - WithURL("https://github.com/alexkohler/prealloc"), - linter.NewConfig(golinters.NewScopelint()). - WithSince("v1.12.0"). + WithURL("https://github.com/tommy-muehle/go-mnd"), + + linter.NewConfig(golinters.NewGoModDirectives(goModDirectivesCfg)). + WithSince("v1.39.0"). + WithPresets(linter.PresetStyle, linter.PresetModule). + WithURL("https://github.com/ldez/gomoddirectives"), + + linter.NewConfig(golinters.NewGomodguard()). + WithSince("v1.25.0"). + WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule). + WithURL("https://github.com/ryancurrah/gomodguard"), + + linter.NewConfig(golinters.NewGoPrintfFuncName()). + WithSince("v1.23.0"). + WithPresets(linter.PresetStyle). + WithURL("https://github.com/jirfag/go-printf-func-name"), + + linter.NewConfig(golinters.NewGosec(gosecCfg)). + WithSince("v1.0.0"). + WithLoadForGoAnalysis(). WithPresets(linter.PresetBugs). - WithURL("https://github.com/kyoh86/scopelint"). - Deprecated("The repository of the linter has been deprecated by the owner.", "v1.39.0", "exportloopref"), - linter.NewConfig(golinters.NewGocritic()). - WithSince("v1.12.0"). - WithPresets(linter.PresetStyle, linter.PresetMetaLinter). + WithURL("https://github.com/securego/gosec"). + WithAlternativeNames("gas"), + + linter.NewConfig(golinters.NewGosimple(gosimpleCfg)). + WithSince("v1.20.0"). WithLoadForGoAnalysis(). - WithURL("https://github.com/go-critic/go-critic"), - linter.NewConfig(golinters.NewGochecknoinits()). - WithSince("v1.12.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/leighmcculloch/gochecknoinits"), - linter.NewConfig(golinters.NewGochecknoglobals()). - WithSince("v1.12.0"). + WithAlternativeNames(megacheckName). + WithURL("https://github.com/dominikh/go-tools/tree/master/simple"), + + linter.NewConfig(golinters.NewGovet(govetCfg)). + WithSince("v1.0.0"). + WithLoadForGoAnalysis(). + WithPresets(linter.PresetBugs, linter.PresetMetaLinter). + WithAlternativeNames("vet", "vetshadow"). + WithURL("https://golang.org/cmd/vet/"), + + linter.NewConfig(golinters.NewGrouper(grouperCfg)). + WithSince("v1.44.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/leighmcculloch/gochecknoglobals"), - linter.NewConfig(golinters.NewGodox()). - WithSince("v1.19.0"). - WithPresets(linter.PresetStyle, linter.PresetComment). - WithURL("https://github.com/matoous/godox"), - linter.NewConfig(golinters.NewFunlen()). - WithSince("v1.18.0"). - WithPresets(linter.PresetComplexity). - WithURL("https://github.com/ultraware/funlen"), - linter.NewConfig(golinters.NewWhitespace()). - WithSince("v1.19.0"). + WithURL("https://github.com/leonklingele/grouper"), + + linter.NewConfig(golinters.NewIfshort(ifshortCfg)). + WithSince("v1.36.0"). WithPresets(linter.PresetStyle). - WithAutoFix(). - WithURL("https://github.com/ultraware/whitespace"), - linter.NewConfig(golinters.NewWSL()). - WithSince("v1.20.0"). + WithURL("https://github.com/esimonov/ifshort"), + + linter.NewConfig(golinters.NewImportAs(importAsCfg)). + WithSince("v1.38.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/bombsimon/wsl"), - linter.NewConfig(golinters.NewGoPrintfFuncName()). - WithSince("v1.23.0"). + WithLoadForGoAnalysis(). + WithURL("https://github.com/julz/importas"), + + linter.NewConfig(golinters.NewIneffassign()). + WithSince("v1.0.0"). + WithPresets(linter.PresetUnused). + WithURL("https://github.com/gordonklaus/ineffassign"), + + linter.NewConfig(golinters.NewInterfacer()). + WithSince("v1.0.0"). + WithLoadForGoAnalysis(). WithPresets(linter.PresetStyle). - WithURL("https://github.com/jirfag/go-printf-func-name"), - linter.NewConfig(golinters.NewGoMND(m.cfg)). - WithSince("v1.22.0"). + WithURL("https://github.com/mvdan/interfacer"). + Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", ""), + + linter.NewConfig(golinters.NewIreturn(ireturnCfg)). + WithSince("v1.43.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/tommy-muehle/go-mnd"), - linter.NewConfig(golinters.NewGoerr113()). - WithSince("v1.26.0"). - WithPresets(linter.PresetStyle, linter.PresetError). WithLoadForGoAnalysis(). - WithURL("https://github.com/Djarvur/go-err113"), - linter.NewConfig(golinters.NewGomodguard()). - WithSince("v1.25.0"). - WithPresets(linter.PresetStyle, linter.PresetImport, linter.PresetModule). - WithURL("https://github.com/ryancurrah/gomodguard"), - linter.NewConfig(golinters.NewGodot()). - WithSince("v1.25.0"). + WithURL("https://github.com/butuzov/ireturn"), + + linter.NewConfig(golinters.NewLLL()). + WithSince("v1.8.0"). + WithPresets(linter.PresetStyle), + + linter.NewConfig(golinters.NewMaintIdx(maintIdxCfg)). + WithSince("v1.44.0"). + WithPresets(linter.PresetComplexity). + WithURL("https://github.com/yagipy/maintidx"), + + linter.NewConfig(golinters.NewMakezero()). + WithSince("v1.34.0"). + WithPresets(linter.PresetStyle, linter.PresetBugs). + WithLoadForGoAnalysis(). + WithURL("https://github.com/ashanbrown/makezero"), + + linter.NewConfig(golinters.NewMaligned()). + WithSince("v1.0.0"). + WithLoadForGoAnalysis(). + WithPresets(linter.PresetPerformance). + WithURL("https://github.com/mdempsky/maligned"). + Deprecated("The repository of the linter has been archived by the owner.", "v1.38.0", "govet 'fieldalignment'"), + + linter.NewConfig(golinters.NewMisspell()). + WithSince("v1.8.0"). WithPresets(linter.PresetStyle, linter.PresetComment). WithAutoFix(). - WithURL("https://github.com/tetafro/godot"), - linter.NewConfig(golinters.NewTestpackage(testpackageCfg)). - WithSince("v1.25.0"). - WithPresets(linter.PresetStyle, linter.PresetTest). - WithURL("https://github.com/maratori/testpackage"), + WithURL("https://github.com/client9/misspell"), + + linter.NewConfig(golinters.NewNakedret()). + WithSince("v1.19.0"). + WithPresets(linter.PresetStyle). + WithURL("https://github.com/alexkohler/nakedret"), + linter.NewConfig(golinters.NewNestif()). WithSince("v1.25.0"). WithPresets(linter.PresetComplexity). WithURL("https://github.com/nakabonne/nestif"), - linter.NewConfig(golinters.NewExportLoopRef()). - WithSince("v1.28.0"). - WithPresets(linter.PresetBugs). + + linter.NewConfig(golinters.NewNilErr()). + WithSince("v1.38.0"). WithLoadForGoAnalysis(). - WithURL("https://github.com/kyoh86/exportloopref"), - linter.NewConfig(golinters.NewExhaustive(exhaustiveCfg)). - WithSince(" v1.28.0"). WithPresets(linter.PresetBugs). + WithURL("https://github.com/gostaticanalysis/nilerr"), + + linter.NewConfig(golinters.NewNilNil(nilNilCfg)). + WithSince("v1.43.0"). + WithPresets(linter.PresetStyle). WithLoadForGoAnalysis(). - WithURL("https://github.com/nishanths/exhaustive"), - linter.NewConfig(golinters.NewSQLCloseCheck()). - WithSince("v1.28.0"). - WithPresets(linter.PresetBugs, linter.PresetSQL). - WithLoadForGoAnalysis(). - WithURL("https://github.com/ryanrolds/sqlclosecheck"), + WithURL("https://github.com/Antonboom/nilnil"), + linter.NewConfig(golinters.NewNLReturn(nlreturnCfg)). WithSince("v1.30.0"). WithPresets(linter.PresetStyle). WithURL("https://github.com/ssgreg/nlreturn"), - linter.NewConfig(golinters.NewWrapcheck(wrapcheckCfg)). - WithSince("v1.32.0"). - WithPresets(linter.PresetStyle, linter.PresetError). - WithLoadForGoAnalysis(). - WithURL("https://github.com/tomarrell/wrapcheck"), - linter.NewConfig(golinters.NewThelper(thelperCfg)). - WithSince("v1.34.0"). - WithPresets(linter.PresetStyle). - WithLoadForGoAnalysis(). - WithURL("https://github.com/kulti/thelper"), - linter.NewConfig(golinters.NewTparallel()). - WithSince("v1.32.0"). - WithPresets(linter.PresetStyle, linter.PresetTest). - WithLoadForGoAnalysis(). - WithURL("https://github.com/moricho/tparallel"), - linter.NewConfig(golinters.NewExhaustiveStruct(exhaustiveStructCfg)). - WithSince("v1.32.0"). - WithPresets(linter.PresetStyle, linter.PresetTest). - WithLoadForGoAnalysis(). - WithURL("https://github.com/mbilski/exhaustivestruct"), - linter.NewConfig(golinters.NewErrorLint(errorlintCfg)). - WithSince("v1.32.0"). - WithPresets(linter.PresetBugs, linter.PresetError). + + linter.NewConfig(golinters.NewNoctx()). + WithSince("v1.28.0"). WithLoadForGoAnalysis(). - WithURL("https://github.com/polyfloyd/go-errorlint"), + WithPresets(linter.PresetPerformance, linter.PresetBugs). + WithURL("https://github.com/sonatard/noctx"), + linter.NewConfig(golinters.NewParallelTest()). WithSince("v1.33.0"). WithPresets(linter.PresetStyle, linter.PresetTest). WithURL("https://github.com/kunwardeep/paralleltest"), - linter.NewConfig(golinters.NewMakezero()). - WithSince("v1.34.0"). - WithPresets(linter.PresetStyle, linter.PresetBugs). - WithLoadForGoAnalysis(). - WithURL("https://github.com/ashanbrown/makezero"), - linter.NewConfig(golinters.NewForbidigo()). - WithSince("v1.34.0"). - WithPresets(linter.PresetStyle). - WithURL("https://github.com/ashanbrown/forbidigo"), - linter.NewConfig(golinters.NewIfshort(ifshortCfg)). - WithSince("v1.36.0"). - WithPresets(linter.PresetStyle). - WithURL("https://github.com/esimonov/ifshort"), + + linter.NewConfig(golinters.NewPrealloc()). + WithSince("v1.19.0"). + WithPresets(linter.PresetPerformance). + WithURL("https://github.com/alexkohler/prealloc"), + linter.NewConfig(golinters.NewPredeclared(predeclaredCfg)). WithSince("v1.35.0"). WithPresets(linter.PresetStyle). WithURL("https://github.com/nishanths/predeclared"), + + linter.NewConfig(golinters.NewPromlinter()). + WithSince("v1.40.0"). + WithPresets(linter.PresetStyle). + WithURL("https://github.com/yeya24/promlinter"), + linter.NewConfig(golinters.NewRevive(reviveCfg)). WithSince("v1.37.0"). WithPresets(linter.PresetStyle, linter.PresetMetaLinter). ConsiderSlow(). WithURL("https://github.com/mgechev/revive"), - linter.NewConfig(golinters.NewDurationCheck()). - WithSince("v1.37.0"). + + linter.NewConfig(golinters.NewRowsErrCheck()). + WithSince("v1.23.0"). + WithLoadForGoAnalysis(). + WithPresets(linter.PresetBugs, linter.PresetSQL). + WithURL("https://github.com/jingyugao/rowserrcheck"), + + linter.NewConfig(golinters.NewScopelint()). + WithSince("v1.12.0"). WithPresets(linter.PresetBugs). + WithURL("https://github.com/kyoh86/scopelint"). + Deprecated("The repository of the linter has been deprecated by the owner.", "v1.39.0", "exportloopref"), + + linter.NewConfig(golinters.NewSQLCloseCheck()). + WithSince("v1.28.0"). + WithPresets(linter.PresetBugs, linter.PresetSQL). WithLoadForGoAnalysis(). - WithURL("https://github.com/charithe/durationcheck"), - linter.NewConfig(golinters.NewWastedAssign()). - WithSince("v1.38.0"). - WithPresets(linter.PresetStyle). + WithURL("https://github.com/ryanrolds/sqlclosecheck"), + + linter.NewConfig(golinters.NewStaticcheck(staticcheckCfg)). + WithSince("v1.0.0"). WithLoadForGoAnalysis(). - WithURL("https://github.com/sanposhiho/wastedassign"), - linter.NewConfig(golinters.NewImportAs(importAsCfg)). - WithSince("v1.38.0"). - WithPresets(linter.PresetStyle). + WithPresets(linter.PresetBugs, linter.PresetMetaLinter). + WithAlternativeNames(megacheckName). + WithURL("https://staticcheck.io/"), + + linter.NewConfig(golinters.NewStructcheck()). + WithSince("v1.0.0"). WithLoadForGoAnalysis(). - WithURL("https://github.com/julz/importas"), - linter.NewConfig(golinters.NewNilErr()). - WithSince("v1.38.0"). + WithPresets(linter.PresetUnused). + WithURL("https://github.com/opennota/check"), + + linter.NewConfig(golinters.NewStylecheck(stylecheckCfg)). + WithSince("v1.20.0"). WithLoadForGoAnalysis(). - WithPresets(linter.PresetBugs). - WithURL("https://github.com/gostaticanalysis/nilerr"), - linter.NewConfig(golinters.NewForceTypeAssert()). - WithSince("v1.38.0"). - WithPresets(linter.PresetStyle). - WithURL("https://github.com/gostaticanalysis/forcetypeassert"), - linter.NewConfig(golinters.NewGoModDirectives(goModDirectivesCfg)). - WithSince("v1.39.0"). - WithPresets(linter.PresetStyle, linter.PresetModule). - WithURL("https://github.com/ldez/gomoddirectives"), - linter.NewConfig(golinters.NewPromlinter()). - WithSince("v1.40.0"). WithPresets(linter.PresetStyle). - WithURL("https://github.com/yeya24/promlinter"), + WithURL("https://github.com/dominikh/go-tools/tree/master/stylecheck"), + linter.NewConfig(golinters.NewTagliatelle(tagliatelleCfg)). WithSince("v1.40.0"). WithPresets(linter.PresetStyle). WithURL("https://github.com/ldez/tagliatelle"), - linter.NewConfig(golinters.NewErrName()). - WithSince("v1.42.0"). - WithPresets(linter.PresetStyle). - WithLoadForGoAnalysis(). - WithURL("https://github.com/Antonboom/errname"), - linter.NewConfig(golinters.NewIreturn(ireturnCfg)). + + linter.NewConfig(golinters.NewTenv(tenvCfg)). WithSince("v1.43.0"). WithPresets(linter.PresetStyle). WithLoadForGoAnalysis(). - WithURL("https://github.com/butuzov/ireturn"), - linter.NewConfig(golinters.NewNilNil(nilNilCfg)). - WithSince("v1.43.0"). + WithURL("https://github.com/sivchari/tenv"), + + linter.NewConfig(golinters.NewTestpackage(testpackageCfg)). + WithSince("v1.25.0"). + WithPresets(linter.PresetStyle, linter.PresetTest). + WithURL("https://github.com/maratori/testpackage"), + + linter.NewConfig(golinters.NewThelper(thelperCfg)). + WithSince("v1.34.0"). WithPresets(linter.PresetStyle). WithLoadForGoAnalysis(). - WithURL("https://github.com/Antonboom/nilnil"), - linter.NewConfig(golinters.NewTenv(tenvCfg)). - WithSince("v1.43.0"). - WithPresets(linter.PresetStyle). + WithURL("https://github.com/kulti/thelper"), + + linter.NewConfig(golinters.NewTparallel()). + WithSince("v1.32.0"). + WithPresets(linter.PresetStyle, linter.PresetTest). + WithLoadForGoAnalysis(). + WithURL("https://github.com/moricho/tparallel"), + + linter.NewConfig(golinters.NewTypecheck()). + WithSince("v1.3.0"). WithLoadForGoAnalysis(). - WithURL("https://github.com/sivchari/tenv"), - linter.NewConfig(golinters.NewContextCheck()). - WithSince("v1.43.0"). WithPresets(linter.PresetBugs). + WithURL(""), + + linter.NewConfig(golinters.NewUnconvert()). + WithSince("v1.0.0"). WithLoadForGoAnalysis(). - WithURL("https://github.com/sylvia7788/contextcheck"), + WithPresets(linter.PresetStyle). + WithURL("https://github.com/mdempsky/unconvert"), + + linter.NewConfig(golinters.NewUnparam()). + WithSince("v1.9.0"). + WithPresets(linter.PresetUnused). + WithLoadForGoAnalysis(). + WithURL("https://github.com/mvdan/unparam"), + + linter.NewConfig(golinters.NewUnused(unusedCfg)). + WithSince("v1.20.0"). + WithLoadForGoAnalysis(). + WithPresets(linter.PresetUnused). + WithAlternativeNames(megacheckName). + ConsiderSlow(). + WithChangeTypes(). + WithURL("https://github.com/dominikh/go-tools/tree/master/unused"), + + linter.NewConfig(golinters.NewVarcheck()). + WithSince("v1.0.0"). + WithLoadForGoAnalysis(). + WithPresets(linter.PresetUnused). + WithURL("https://github.com/opennota/check"), + linter.NewConfig(golinters.NewVarnamelen(varnamelenCfg)). WithSince("v1.43.0"). WithPresets(linter.PresetStyle). WithLoadForGoAnalysis(). WithURL("https://github.com/blizzy78/varnamelen"), - linter.NewConfig(golinters.NewBiDiChkFuncName()). - WithSince("1.43.0"). - WithPresets(linter.PresetBugs). - WithURL("https://github.com/breml/bidichk"), + + linter.NewConfig(golinters.NewWastedAssign()). + WithSince("v1.38.0"). + WithPresets(linter.PresetStyle). + WithLoadForGoAnalysis(). + WithURL("https://github.com/sanposhiho/wastedassign"), + + linter.NewConfig(golinters.NewWhitespace()). + WithSince("v1.19.0"). + WithPresets(linter.PresetStyle). + WithAutoFix(). + WithURL("https://github.com/ultraware/whitespace"), + + linter.NewConfig(golinters.NewWrapcheck(wrapcheckCfg)). + WithSince("v1.32.0"). + WithPresets(linter.PresetStyle, linter.PresetError). + WithLoadForGoAnalysis(). + WithURL("https://github.com/tomarrell/wrapcheck"), + + linter.NewConfig(golinters.NewWSL()). + WithSince("v1.20.0"). + WithPresets(linter.PresetStyle). + WithURL("https://github.com/bombsimon/wsl"), // nolintlint must be last because it looks at the results of all the previous linters for unused nolint directives linter.NewConfig(golinters.NewNoLintLint()). diff --git a/pkg/lint/lintersdb/validator.go b/pkg/lint/lintersdb/validator.go index 47c1289306c4..2f00351857a0 100644 --- a/pkg/lint/lintersdb/validator.go +++ b/pkg/lint/lintersdb/validator.go @@ -21,7 +21,7 @@ func (v Validator) validateLintersNames(cfg *config.Linters) error { allNames := append([]string{}, cfg.Enable...) allNames = append(allNames, cfg.Disable...) - unknownNames := []string{} + var unknownNames []string for _, name := range allNames { if v.m.GetLinterConfigs(name) == nil { diff --git a/pkg/lint/load.go b/pkg/lint/load.go index 69852afb9878..a393a1d081eb 100644 --- a/pkg/lint/load.go +++ b/pkg/lint/load.go @@ -84,7 +84,7 @@ func (cl *ContextLoader) buildArgs() []string { if strings.HasPrefix(arg, ".") || filepath.IsAbs(arg) { retArgs = append(retArgs, arg) } else { - // go/packages doesn't work well if we don't have prefix ./ for local packages + // go/packages doesn't work well if we don't have the prefix ./ for local packages retArgs = append(retArgs, fmt.Sprintf(".%c%s", filepath.Separator, arg)) } } diff --git a/pkg/lint/runner.go b/pkg/lint/runner.go index 856eec6b6f42..e1a77c7d6885 100644 --- a/pkg/lint/runner.go +++ b/pkg/lint/runner.go @@ -6,6 +6,7 @@ import ( "runtime/debug" "strings" + "github.com/hashicorp/go-multierror" "github.com/pkg/errors" gopackages "golang.org/x/tools/go/packages" @@ -123,7 +124,7 @@ func (r *Runner) runLinterSafe(ctx context.Context, lintCtx *linter.Context, // which affects to the next analysis. // To avoid this issue, we clear type information from the packages. // See https://github.com/golangci/golangci-lint/pull/944. - // Currently DoesChangeTypes is true only for `unused`. + // Currently, DoesChangeTypes is true only for `unused`. lintCtx.ClearTypesInPackages() } @@ -192,20 +193,26 @@ func (r Runner) Run(ctx context.Context, linters []*linter.Config, lintCtx *lint sw := timeutils.NewStopwatch("linters", r.Log) defer sw.Print() - var issues []result.Issue + var ( + lintErrors *multierror.Error + issues []result.Issue + ) + for _, lc := range linters { lc := lc sw.TrackStage(lc.Name(), func() { linterIssues, err := r.runLinterSafe(ctx, lintCtx, lc) if err != nil { + lintErrors = multierror.Append(lintErrors, fmt.Errorf("can't run linter %s: %w", lc.Linter.Name(), err)) r.Log.Warnf("Can't run linter %s: %v", lc.Linter.Name(), err) + return } issues = append(issues, linterIssues...) }) } - return r.processLintResults(issues), nil + return r.processLintResults(issues), lintErrors.ErrorOrNil() } func (r *Runner) processIssues(issues []result.Issue, sw *timeutils.Stopwatch, statPerProcessor map[string]processorStat) []result.Issue { diff --git a/pkg/logutils/log.go b/pkg/logutils/log.go index b955417a87ac..57c35c784ab3 100644 --- a/pkg/logutils/log.go +++ b/pkg/logutils/log.go @@ -17,11 +17,11 @@ const ( // Debug messages, write to debug logs only by logutils.Debug. LogLevelDebug LogLevel = 0 - // Information messages, don't write too much messages, + // Information messages, don't write too many messages, // only useful ones: they are shown when running with -v. LogLevelInfo LogLevel = 1 - // Hidden errors: non critical errors: work can be continued, no need to fail whole program; + // Hidden errors: non-critical errors: work can be continued, no need to fail whole program; // tests will crash if any warning occurred. LogLevelWarn LogLevel = 2 diff --git a/pkg/packages/errors.go b/pkg/packages/errors.go index c620573b9380..72fb8601ab70 100644 --- a/pkg/packages/errors.go +++ b/pkg/packages/errors.go @@ -9,7 +9,6 @@ import ( "github.com/pkg/errors" ) -//nolint:gomnd func ParseErrorPosition(pos string) (*token.Position, error) { // file:line(:colon) parts := strings.Split(pos, ":") diff --git a/pkg/packages/util.go b/pkg/packages/util.go index e4268897f452..6a7789ebb730 100644 --- a/pkg/packages/util.go +++ b/pkg/packages/util.go @@ -42,7 +42,7 @@ func ExtractErrors(pkg *packages.Package) []packages.Error { continue } - // change pos to local file to properly process it by processors (properly read line etc) + // change pos to local file to properly process it by processors (properly read line etc.) uniqErrors[i].Msg = fmt.Sprintf("%s: %s", uniqErrors[i].Pos, uniqErrors[i].Msg) uniqErrors[i].Pos = fmt.Sprintf("%s:1", pkg.GoFiles[0]) } @@ -65,7 +65,7 @@ func extractErrorsImpl(pkg *packages.Package, seenPackages map[*packages.Package } seenPackages[pkg] = true - if !pkg.IllTyped { // otherwise it may take hours to traverse all deps many times + if !pkg.IllTyped { // otherwise, it may take hours to traverse all deps many times return nil } diff --git a/pkg/printers/checkstyle.go b/pkg/printers/checkstyle.go index c5b948a98d29..bb347bd2baa6 100644 --- a/pkg/printers/checkstyle.go +++ b/pkg/printers/checkstyle.go @@ -4,10 +4,11 @@ import ( "context" "encoding/xml" "fmt" + "io" + "sort" "github.com/go-xmlfmt/xmlfmt" - "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -32,13 +33,15 @@ type checkstyleError struct { const defaultCheckstyleSeverity = "error" -type Checkstyle struct{} +type Checkstyle struct { + w io.Writer +} -func NewCheckstyle() *Checkstyle { - return &Checkstyle{} +func NewCheckstyle(w io.Writer) *Checkstyle { + return &Checkstyle{w: w} } -func (Checkstyle) Print(ctx context.Context, issues []result.Issue) error { +func (p Checkstyle) Print(ctx context.Context, issues []result.Issue) error { out := checkstyleOutput{ Version: "5.0", } @@ -77,11 +80,19 @@ func (Checkstyle) Print(ctx context.Context, issues []result.Issue) error { out.Files = append(out.Files, file) } + sort.Slice(out.Files, func(i, j int) bool { + return out.Files[i].Name < out.Files[j].Name + }) + data, err := xml.Marshal(&out) if err != nil { return err } - fmt.Fprintf(logutils.StdOut, "%s%s\n", xml.Header, xmlfmt.FormatXML(string(data), "", " ")) + _, err = fmt.Fprintf(p.w, "%s%s\n", xml.Header, xmlfmt.FormatXML(string(data), "", " ")) + if err != nil { + return err + } + return nil } diff --git a/pkg/printers/checkstyle_test.go b/pkg/printers/checkstyle_test.go new file mode 100644 index 000000000000..58b8db7f0960 --- /dev/null +++ b/pkg/printers/checkstyle_test.go @@ -0,0 +1,57 @@ +//nolint:dupl +package printers + +import ( + "bytes" + "context" + "go/token" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/golangci/golangci-lint/pkg/result" +) + +func TestCheckstyle_Print(t *testing.T) { + issues := []result.Issue{ + { + FromLinter: "linter-a", + Severity: "warning", + Text: "some issue", + Pos: token.Position{ + Filename: "path/to/filea.go", + Offset: 2, + Line: 10, + Column: 4, + }, + }, + { + FromLinter: "linter-b", + Severity: "error", + Text: "another issue", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/fileb.go", + Offset: 5, + Line: 300, + Column: 9, + }, + }, + } + + buf := new(bytes.Buffer) + printer := NewCheckstyle(buf) + + err := printer.Print(context.Background(), issues) + require.NoError(t, err) + + //nolint:lll + expected := "\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\n" + + assert.Equal(t, expected, buf.String()) +} diff --git a/pkg/printers/codeclimate.go b/pkg/printers/codeclimate.go index d4e5b5e058a4..8127632e74d6 100644 --- a/pkg/printers/codeclimate.go +++ b/pkg/printers/codeclimate.go @@ -4,8 +4,8 @@ import ( "context" "encoding/json" "fmt" + "io" - "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -24,10 +24,11 @@ type CodeClimateIssue struct { } type CodeClimate struct { + w io.Writer } -func NewCodeClimate() *CodeClimate { - return &CodeClimate{} +func NewCodeClimate(w io.Writer) *CodeClimate { + return &CodeClimate{w: w} } func (p CodeClimate) Print(ctx context.Context, issues []result.Issue) error { @@ -52,6 +53,9 @@ func (p CodeClimate) Print(ctx context.Context, issues []result.Issue) error { return err } - fmt.Fprint(logutils.StdOut, string(outputJSON)) + _, err = fmt.Fprint(p.w, string(outputJSON)) + if err != nil { + return err + } return nil } diff --git a/pkg/printers/codeclimate_test.go b/pkg/printers/codeclimate_test.go new file mode 100644 index 000000000000..5c25002a8907 --- /dev/null +++ b/pkg/printers/codeclimate_test.go @@ -0,0 +1,57 @@ +//nolint:dupl +package printers + +import ( + "bytes" + "context" + "go/token" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/golangci/golangci-lint/pkg/result" +) + +func TestCodeClimate_Print(t *testing.T) { + issues := []result.Issue{ + { + FromLinter: "linter-a", + Severity: "warning", + Text: "some issue", + Pos: token.Position{ + Filename: "path/to/filea.go", + Offset: 2, + Line: 10, + Column: 4, + }, + }, + { + FromLinter: "linter-b", + Severity: "error", + Text: "another issue", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/fileb.go", + Offset: 5, + Line: 300, + Column: 9, + }, + }, + } + + buf := new(bytes.Buffer) + printer := NewCodeClimate(buf) + + err := printer.Print(context.Background(), issues) + require.NoError(t, err) + + //nolint:lll + expected := `[{"description":"linter-a: some issue","severity":"warning","fingerprint":"BA73C5DF4A6FD8462FFF1D3140235777","location":{"path":"path/to/filea.go","lines":{"begin":10}}},{"description":"linter-b: another issue","severity":"error","fingerprint":"0777B4FE60242BD8B2E9B7E92C4B9521","location":{"path":"path/to/fileb.go","lines":{"begin":300}}}]` + + assert.Equal(t, expected, buf.String()) +} diff --git a/pkg/printers/github.go b/pkg/printers/github.go index c7186ac273ed..6a4d05d46f3b 100644 --- a/pkg/printers/github.go +++ b/pkg/printers/github.go @@ -3,20 +3,21 @@ package printers import ( "context" "fmt" + "io" - "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) type github struct { + w io.Writer } const defaultGithubSeverity = "error" // NewGithub output format outputs issues according to GitHub actions format: // https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message -func NewGithub() Printer { - return &github{} +func NewGithub(w io.Writer) Printer { + return &github{w: w} } // print each line as: ::error file=app.js,line=10,col=15::Something went wrong @@ -35,9 +36,9 @@ func formatIssueAsGithub(issue *result.Issue) string { return ret } -func (g *github) Print(_ context.Context, issues []result.Issue) error { +func (p *github) Print(_ context.Context, issues []result.Issue) error { for ind := range issues { - _, err := fmt.Fprintln(logutils.StdOut, formatIssueAsGithub(&issues[ind])) + _, err := fmt.Fprintln(p.w, formatIssueAsGithub(&issues[ind])) if err != nil { return err } diff --git a/pkg/printers/github_test.go b/pkg/printers/github_test.go index 0ab79bb82ee8..1e7772d25550 100644 --- a/pkg/printers/github_test.go +++ b/pkg/printers/github_test.go @@ -1,14 +1,61 @@ package printers import ( + "bytes" + "context" "go/token" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/golangci/golangci-lint/pkg/result" ) +func TestGithub_Print(t *testing.T) { + issues := []result.Issue{ + { + FromLinter: "linter-a", + Severity: "warning", + Text: "some issue", + Pos: token.Position{ + Filename: "path/to/filea.go", + Offset: 2, + Line: 10, + Column: 4, + }, + }, + { + FromLinter: "linter-b", + Severity: "error", + Text: "another issue", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/fileb.go", + Offset: 5, + Line: 300, + Column: 9, + }, + }, + } + + buf := new(bytes.Buffer) + printer := NewGithub(buf) + + err := printer.Print(context.Background(), issues) + require.NoError(t, err) + + expected := `::warning file=path/to/filea.go,line=10,col=4::some issue (linter-a) +::error file=path/to/fileb.go,line=300,col=9::another issue (linter-b) +` + + assert.Equal(t, expected, buf.String()) +} + func TestFormatGithubIssue(t *testing.T) { sampleIssue := result.Issue{ FromLinter: "sample-linter", diff --git a/pkg/printers/html.go b/pkg/printers/html.go index 65ab753bd512..3d82d7d8bd7f 100644 --- a/pkg/printers/html.go +++ b/pkg/printers/html.go @@ -4,9 +4,9 @@ import ( "context" "fmt" "html/template" + "io" "strings" - "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -123,13 +123,15 @@ type htmlIssue struct { Code string } -type HTML struct{} +type HTML struct { + w io.Writer +} -func NewHTML() *HTML { - return &HTML{} +func NewHTML(w io.Writer) *HTML { + return &HTML{w: w} } -func (h HTML) Print(_ context.Context, issues []result.Issue) error { +func (p HTML) Print(_ context.Context, issues []result.Issue) error { var htmlIssues []htmlIssue for i := range issues { @@ -151,5 +153,5 @@ func (h HTML) Print(_ context.Context, issues []result.Issue) error { return err } - return t.Execute(logutils.StdOut, struct{ Issues []htmlIssue }{Issues: htmlIssues}) + return t.Execute(p.w, struct{ Issues []htmlIssue }{Issues: htmlIssues}) } diff --git a/pkg/printers/html_test.go b/pkg/printers/html_test.go new file mode 100644 index 000000000000..1c3306d7dec6 --- /dev/null +++ b/pkg/printers/html_test.go @@ -0,0 +1,160 @@ +package printers + +import ( + "bytes" + "context" + "go/token" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/golangci/golangci-lint/pkg/result" +) + +//nolint:lll +const expectedHTML = ` + + + + golangci-lint + + + + + + + + + + +
+
+
+
+
+ + + +` + +func TestHTML_Print(t *testing.T) { + issues := []result.Issue{ + { + FromLinter: "linter-a", + Severity: "warning", + Text: "some issue", + Pos: token.Position{ + Filename: "path/to/filea.go", + Offset: 2, + Line: 10, + Column: 4, + }, + }, + { + FromLinter: "linter-b", + Severity: "error", + Text: "another issue", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/fileb.go", + Offset: 5, + Line: 300, + Column: 9, + }, + }, + } + + buf := new(bytes.Buffer) + printer := NewHTML(buf) + + err := printer.Print(context.Background(), issues) + require.NoError(t, err) + + assert.Equal(t, expectedHTML, buf.String()) +} diff --git a/pkg/printers/json.go b/pkg/printers/json.go index 6ffa996fb0e4..cfef51f587fb 100644 --- a/pkg/printers/json.go +++ b/pkg/printers/json.go @@ -3,20 +3,21 @@ package printers import ( "context" "encoding/json" - "fmt" + "io" - "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/report" "github.com/golangci/golangci-lint/pkg/result" ) type JSON struct { rd *report.Data + w io.Writer } -func NewJSON(rd *report.Data) *JSON { +func NewJSON(rd *report.Data, w io.Writer) *JSON { return &JSON{ rd: rd, + w: w, } } @@ -30,12 +31,9 @@ func (p JSON) Print(ctx context.Context, issues []result.Issue) error { Issues: issues, Report: p.rd, } - - outputJSON, err := json.Marshal(res) - if err != nil { - return err + if res.Issues == nil { + res.Issues = []result.Issue{} } - fmt.Fprint(logutils.StdOut, string(outputJSON)) - return nil + return json.NewEncoder(p.w).Encode(res) } diff --git a/pkg/printers/json_test.go b/pkg/printers/json_test.go new file mode 100644 index 000000000000..402c8d6a271b --- /dev/null +++ b/pkg/printers/json_test.go @@ -0,0 +1,58 @@ +package printers + +import ( + "bytes" + "context" + "go/token" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/golangci/golangci-lint/pkg/result" +) + +func TestJSON_Print(t *testing.T) { + issues := []result.Issue{ + { + FromLinter: "linter-a", + Severity: "warning", + Text: "some issue", + Pos: token.Position{ + Filename: "path/to/filea.go", + Offset: 2, + Line: 10, + Column: 4, + }, + }, + { + FromLinter: "linter-b", + Severity: "error", + Text: "another issue", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/fileb.go", + Offset: 5, + Line: 300, + Column: 9, + }, + }, + } + + buf := new(bytes.Buffer) + + printer := NewJSON(nil, buf) + + err := printer.Print(context.Background(), issues) + require.NoError(t, err) + + //nolint:lll + expected := `{"Issues":[{"FromLinter":"linter-a","Text":"some issue","Severity":"warning","SourceLines":null,"Replacement":null,"Pos":{"Filename":"path/to/filea.go","Offset":2,"Line":10,"Column":4},"ExpectNoLint":false,"ExpectedNoLintLinter":""},{"FromLinter":"linter-b","Text":"another issue","Severity":"error","SourceLines":["func foo() {","\tfmt.Println(\"bar\")","}"],"Replacement":null,"Pos":{"Filename":"path/to/fileb.go","Offset":5,"Line":300,"Column":9},"ExpectNoLint":false,"ExpectedNoLintLinter":""}],"Report":null} +` + + assert.Equal(t, expected, buf.String()) +} diff --git a/pkg/printers/junitxml.go b/pkg/printers/junitxml.go index 9277cd66f2fe..0424f78b48d7 100644 --- a/pkg/printers/junitxml.go +++ b/pkg/printers/junitxml.go @@ -3,9 +3,11 @@ package printers import ( "context" "encoding/xml" + "fmt" + "io" + "sort" "strings" - "github.com/golangci/golangci-lint/pkg/logutils" "github.com/golangci/golangci-lint/pkg/result" ) @@ -31,17 +33,19 @@ type testCaseXML struct { type failureXML struct { Message string `xml:"message,attr"` + Type string `xml:"type,attr"` Content string `xml:",cdata"` } type JunitXML struct { + w io.Writer } -func NewJunitXML() *JunitXML { - return &JunitXML{} +func NewJunitXML(w io.Writer) *JunitXML { + return &JunitXML{w: w} } -func (JunitXML) Print(ctx context.Context, issues []result.Issue) error { +func (p JunitXML) Print(ctx context.Context, issues []result.Issue) error { suites := make(map[string]testSuiteXML) // use a map to group by file for ind := range issues { @@ -56,8 +60,10 @@ func (JunitXML) Print(ctx context.Context, issues []result.Issue) error { Name: i.FromLinter, ClassName: i.Pos.String(), Failure: failureXML{ - Message: i.Text, - Content: strings.Join(i.SourceLines, "\n"), + Type: i.Severity, + Message: i.Pos.String() + ": " + i.Text, + Content: fmt.Sprintf("%s: %s\nCategory: %s\nFile: %s\nLine: %d\nDetails: %s", + i.Severity, i.Text, i.FromLinter, i.Pos.Filename, i.Pos.Line, strings.Join(i.SourceLines, "\n")), }, } @@ -70,7 +76,11 @@ func (JunitXML) Print(ctx context.Context, issues []result.Issue) error { res.TestSuites = append(res.TestSuites, val) } - enc := xml.NewEncoder(logutils.StdOut) + sort.Slice(res.TestSuites, func(i, j int) bool { + return res.TestSuites[i].Suite < res.TestSuites[j].Suite + }) + + enc := xml.NewEncoder(p.w) enc.Indent("", " ") if err := enc.Encode(res); err != nil { return err diff --git a/pkg/printers/junitxml_test.go b/pkg/printers/junitxml_test.go new file mode 100644 index 000000000000..bc994be2fb7c --- /dev/null +++ b/pkg/printers/junitxml_test.go @@ -0,0 +1,77 @@ +//nolint:dupl +package printers + +import ( + "bytes" + "context" + "go/token" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/golangci/golangci-lint/pkg/result" +) + +func TestJunitXML_Print(t *testing.T) { + issues := []result.Issue{ + { + FromLinter: "linter-a", + Severity: "warning", + Text: "some issue", + Pos: token.Position{ + Filename: "path/to/filea.go", + Offset: 2, + Line: 10, + Column: 4, + }, + }, + { + FromLinter: "linter-b", + Severity: "error", + Text: "another issue", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/fileb.go", + Offset: 5, + Line: 300, + Column: 9, + }, + }, + } + + buf := new(bytes.Buffer) + printer := NewJunitXML(buf) + + err := printer.Print(context.Background(), issues) + require.NoError(t, err) + + expected := ` + + + + + + + + + + +` + + assert.Equal(t, expected, buf.String()) +} diff --git a/pkg/printers/tab.go b/pkg/printers/tab.go index d3cdce673dd8..4a126bde6153 100644 --- a/pkg/printers/tab.go +++ b/pkg/printers/tab.go @@ -15,12 +15,14 @@ import ( type Tab struct { printLinterName bool log logutils.Log + w io.Writer } -func NewTab(printLinterName bool, log logutils.Log) *Tab { +func NewTab(printLinterName bool, log logutils.Log, w io.Writer) *Tab { return &Tab{ printLinterName: printLinterName, log: log, + w: w, } } @@ -30,7 +32,7 @@ func (p Tab) SprintfColored(ca color.Attribute, format string, args ...interface } func (p *Tab) Print(ctx context.Context, issues []result.Issue) error { - w := tabwriter.NewWriter(logutils.StdOut, 0, 0, 2, ' ', 0) + w := tabwriter.NewWriter(p.w, 0, 0, 2, ' ', 0) for i := range issues { p.printIssue(&issues[i], w) diff --git a/pkg/printers/tab_test.go b/pkg/printers/tab_test.go new file mode 100644 index 000000000000..abef2a225ea0 --- /dev/null +++ b/pkg/printers/tab_test.go @@ -0,0 +1,59 @@ +package printers + +import ( + "bytes" + "context" + "go/token" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/golangci/golangci-lint/pkg/logutils" + "github.com/golangci/golangci-lint/pkg/result" +) + +func TestTab_Print(t *testing.T) { + issues := []result.Issue{ + { + FromLinter: "linter-a", + Severity: "warning", + Text: "some issue", + Pos: token.Position{ + Filename: "path/to/filea.go", + Offset: 2, + Line: 10, + Column: 4, + }, + }, + { + FromLinter: "linter-b", + Severity: "error", + Text: "another issue", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/fileb.go", + Offset: 5, + Line: 300, + Column: 9, + }, + }, + } + + buf := new(bytes.Buffer) + + printer := NewTab(true, logutils.NewStderrLog(""), buf) + + err := printer.Print(context.Background(), issues) + require.NoError(t, err) + + expected := `path/to/filea.go:10:4 linter-a some issue +path/to/fileb.go:300:9 linter-b another issue +` + + assert.Equal(t, expected, buf.String()) +} diff --git a/pkg/printers/text.go b/pkg/printers/text.go index 1814528884c4..c8960e0e9e00 100644 --- a/pkg/printers/text.go +++ b/pkg/printers/text.go @@ -3,6 +3,7 @@ package printers import ( "context" "fmt" + "io" "strings" "github.com/fatih/color" @@ -17,14 +18,16 @@ type Text struct { printLinterName bool log logutils.Log + w io.Writer } -func NewText(printIssuedLine, useColors, printLinterName bool, log logutils.Log) *Text { +func NewText(printIssuedLine, useColors, printLinterName bool, log logutils.Log, w io.Writer) *Text { return &Text{ printIssuedLine: printIssuedLine, useColors: useColors, printLinterName: printLinterName, log: log, + w: w, } } @@ -61,12 +64,12 @@ func (p Text) printIssue(i *result.Issue) { if i.Pos.Column != 0 { pos += fmt.Sprintf(":%d", i.Pos.Column) } - fmt.Fprintf(logutils.StdOut, "%s: %s\n", pos, text) + fmt.Fprintf(p.w, "%s: %s\n", pos, text) } func (p Text) printSourceCode(i *result.Issue) { for _, line := range i.SourceLines { - fmt.Fprintln(logutils.StdOut, line) + fmt.Fprintln(p.w, line) } } @@ -87,5 +90,5 @@ func (p Text) printUnderLinePointer(i *result.Issue) { } } - fmt.Fprintf(logutils.StdOut, "%s%s\n", string(prefixRunes), p.SprintfColored(color.FgYellow, "^")) + fmt.Fprintf(p.w, "%s%s\n", string(prefixRunes), p.SprintfColored(color.FgYellow, "^")) } diff --git a/pkg/printers/text_test.go b/pkg/printers/text_test.go new file mode 100644 index 000000000000..06e87214a1af --- /dev/null +++ b/pkg/printers/text_test.go @@ -0,0 +1,62 @@ +package printers + +import ( + "bytes" + "context" + "go/token" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/golangci/golangci-lint/pkg/logutils" + "github.com/golangci/golangci-lint/pkg/result" +) + +func TestText_Print(t *testing.T) { + issues := []result.Issue{ + { + FromLinter: "linter-a", + Severity: "warning", + Text: "some issue", + Pos: token.Position{ + Filename: "path/to/filea.go", + Offset: 2, + Line: 10, + Column: 4, + }, + }, + { + FromLinter: "linter-b", + Severity: "error", + Text: "another issue", + SourceLines: []string{ + "func foo() {", + "\tfmt.Println(\"bar\")", + "}", + }, + Pos: token.Position{ + Filename: "path/to/fileb.go", + Offset: 5, + Line: 300, + Column: 9, + }, + }, + } + + buf := new(bytes.Buffer) + + printer := NewText(true, false, true, logutils.NewStderrLog(""), buf) + + err := printer.Print(context.Background(), issues) + require.NoError(t, err) + + expected := `path/to/filea.go:10:4: some issue (linter-a) +path/to/fileb.go:300:9: another issue (linter-b) +func foo() { + fmt.Println("bar") +} +` + + assert.Equal(t, expected, buf.String()) +} diff --git a/pkg/result/processors/nolint.go b/pkg/result/processors/nolint.go index 8576b22dbfae..12ae0fc2d546 100644 --- a/pkg/result/processors/nolint.go +++ b/pkg/result/processors/nolint.go @@ -17,6 +17,7 @@ import ( ) var nolintDebugf = logutils.Debug("nolint") +var nolintRe = regexp.MustCompile(`^nolint( |:|$)`) type ignoredRange struct { linters []string @@ -46,7 +47,7 @@ func (i *ignoredRange) doesMatch(issue *result.Issue) bool { } // handle possible unused nolint directives - // nolintlint generates potential issues for every nolint directive and they are filtered out here + // nolintlint generates potential issues for every nolint directive, and they are filtered out here if issue.FromLinter == golinters.NolintlintName && issue.ExpectNoLint { if issue.ExpectedNoLintLinter != "" { return i.matchedIssueFromLinter[issue.ExpectedNoLintLinter] @@ -234,7 +235,7 @@ func (p *Nolint) extractFileCommentsInlineRanges(fset *token.FileSet, comments . func (p *Nolint) extractInlineRangeFromComment(text string, g ast.Node, fset *token.FileSet) *ignoredRange { text = strings.TrimLeft(text, "/ ") - if ok, _ := regexp.MatchString(`^nolint( |:|$)`, text); !ok { + if !nolintRe.MatchString(text) { return nil } diff --git a/pkg/result/processors/sort_results.go b/pkg/result/processors/sort_results.go index e726c3adfe05..f93059590af5 100644 --- a/pkg/result/processors/sort_results.go +++ b/pkg/result/processors/sort_results.go @@ -9,7 +9,7 @@ import ( ) // Base propose of this functionality to sort results (issues) -// produced by various linters by analyzing code. We achieving this +// produced by various linters by analyzing code. We're achieving this // by sorting results.Issues using processor step, and chain based // rules that can compare different properties of the Issues struct. @@ -63,7 +63,6 @@ func (c compareResult) isNeutral() bool { return c == None || c == Equal } -//nolint:exhaustive func (c compareResult) String() string { switch c { case Less: diff --git a/pkg/timeutils/stopwatch.go b/pkg/timeutils/stopwatch.go index b973bbc210a0..d944dea2ea0e 100644 --- a/pkg/timeutils/stopwatch.go +++ b/pkg/timeutils/stopwatch.go @@ -71,7 +71,7 @@ func (s *Stopwatch) sprintTopStages(n int) string { stageDurations := s.stageDurationsSorted() - stagesStrings := []string{} + var stagesStrings []string for i := 0; i < len(stageDurations) && i < n; i++ { s := stageDurations[i] stagesStrings = append(stagesStrings, fmt.Sprintf("%s: %s", s.name, s.d)) diff --git a/scripts/expand_website_templates/main.go b/scripts/expand_website_templates/main.go index 9d045cf93bad..d82e94abefe7 100644 --- a/scripts/expand_website_templates/main.go +++ b/scripts/expand_website_templates/main.go @@ -165,7 +165,7 @@ func buildTemplateContext() (map[string]string, error) { return nil, fmt.Errorf("can't read .golangci.example.yml: %s", err) } - lintersCfg, err := getLintersConfiguration(golangciYamlExample) + snippets, err := extractExampleSnippets(golangciYamlExample) if err != nil { return nil, fmt.Errorf("can't read .golangci.example.yml: %s", err) } @@ -202,8 +202,8 @@ func buildTemplateContext() (map[string]string, error) { } return map[string]string{ - "LintersExample": lintersCfg, - "GolangciYamlExample": strings.TrimSpace(string(golangciYamlExample)), + "LintersExample": snippets.LintersSettings, + "ConfigurationExample": snippets.ConfigurationFile, "LintersCommandOutputEnabledOnly": string(lintersOutParts[0]), "LintersCommandOutputDisabledOnly": string(lintersOutParts[1]), "EnabledByDefaultLinters": getLintersListMarkdown(true), @@ -317,58 +317,166 @@ func getThanksList() string { return strings.Join(lines, "\n") } -func getLintersConfiguration(example []byte) (string, error) { - builder := &strings.Builder{} +type SettingSnippets struct { + ConfigurationFile string + LintersSettings string +} +func extractExampleSnippets(example []byte) (*SettingSnippets, error) { var data yaml.Node err := yaml.Unmarshal(example, &data) if err != nil { - return "", err + return nil, err } root := data.Content[0] + globalNode := &yaml.Node{ + Kind: root.Kind, + Style: root.Style, + Tag: root.Tag, + Value: root.Value, + Anchor: root.Anchor, + Alias: root.Alias, + HeadComment: root.HeadComment, + LineComment: root.LineComment, + FootComment: root.FootComment, + Line: root.Line, + Column: root.Column, + } + + snippets := SettingSnippets{} + + builder := strings.Builder{} + for j, node := range root.Content { - if node.Value != "linters-settings" { + switch node.Value { + case "run", "output", "linters", "linters-settings", "issues", "severity": + default: continue } - nodes := root.Content[j+1] - - for i := 0; i < len(nodes.Content); i += 2 { - r := &yaml.Node{ - Kind: nodes.Kind, - Style: nodes.Style, - Tag: nodes.Tag, - Value: node.Value, - Content: []*yaml.Node{ - { - Kind: root.Content[j].Kind, - Value: root.Content[j].Value, - }, - { - Kind: nodes.Kind, - Content: []*yaml.Node{nodes.Content[i], nodes.Content[i+1]}, - }, + nextNode := root.Content[j+1] + + newNode := &yaml.Node{ + Kind: nextNode.Kind, + Content: []*yaml.Node{ + { + HeadComment: fmt.Sprintf("See the dedicated %q documentation section.", node.Value), + Kind: node.Kind, + Style: node.Style, + Tag: node.Tag, + Value: "option", }, - } - - _, _ = fmt.Fprintf(builder, "### %s\n\n", nodes.Content[i].Value) - _, _ = fmt.Fprintln(builder, "```yaml") + { + Kind: node.Kind, + Style: node.Style, + Tag: node.Tag, + Value: "value", + }, + }, + } - const ident = 2 - encoder := yaml.NewEncoder(builder) - encoder.SetIndent(ident) + globalNode.Content = append(globalNode.Content, node, newNode) - err = encoder.Encode(r) + if node.Value == "linters-settings" { + snippets.LintersSettings, err = getLintersSettingSnippets(node, nextNode) if err != nil { - return "", err + return nil, err } - _, _ = fmt.Fprintln(builder, "```") - _, _ = fmt.Fprintln(builder) + _, _ = builder.WriteString( + fmt.Sprintf( + "### `%s` configuration\n\nSee the dedicated [linters-settings](/usage/linters) documentation section.\n\n", + node.Value, + ), + ) + continue + } + + nodeSection := &yaml.Node{ + Kind: root.Kind, + Style: root.Style, + Tag: root.Tag, + Value: root.Value, + Content: []*yaml.Node{node, nextNode}, + } + + snippet, errSnip := marshallSnippet(nodeSection) + if errSnip != nil { + return nil, errSnip + } + + _, _ = builder.WriteString(fmt.Sprintf("### `%s` configuration\n\n%s", node.Value, snippet)) + } + + overview, err := marshallSnippet(globalNode) + if err != nil { + return nil, err + } + + snippets.ConfigurationFile = overview + builder.String() + + return &snippets, nil +} + +func getLintersSettingSnippets(node, nextNode *yaml.Node) (string, error) { + builder := &strings.Builder{} + + for i := 0; i < len(nextNode.Content); i += 2 { + r := &yaml.Node{ + Kind: nextNode.Kind, + Style: nextNode.Style, + Tag: nextNode.Tag, + Value: node.Value, + Content: []*yaml.Node{ + { + Kind: node.Kind, + Value: node.Value, + }, + { + Kind: nextNode.Kind, + Content: []*yaml.Node{nextNode.Content[i], nextNode.Content[i+1]}, + }, + }, } + + _, _ = fmt.Fprintf(builder, "### %s\n\n", nextNode.Content[i].Value) + _, _ = fmt.Fprintln(builder, "```yaml") + + encoder := yaml.NewEncoder(builder) + encoder.SetIndent(2) + + err := encoder.Encode(r) + if err != nil { + return "", err + } + + _, _ = fmt.Fprintln(builder, "```") + _, _ = fmt.Fprintln(builder) } return builder.String(), nil } + +func marshallSnippet(node *yaml.Node) (string, error) { + builder := &strings.Builder{} + + if node.Value != "" { + _, _ = fmt.Fprintf(builder, "### %s\n\n", node.Value) + } + _, _ = fmt.Fprintln(builder, "```yaml") + + encoder := yaml.NewEncoder(builder) + encoder.SetIndent(2) + + err := encoder.Encode(node) + if err != nil { + return "", err + } + + _, _ = fmt.Fprintln(builder, "```") + _, _ = fmt.Fprintln(builder) + + return builder.String(), nil +} diff --git a/scripts/expand_website_templates/main_test.go b/scripts/expand_website_templates/main_test.go new file mode 100644 index 000000000000..24afffb8b59b --- /dev/null +++ b/scripts/expand_website_templates/main_test.go @@ -0,0 +1,20 @@ +package main + +import ( + "os" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_extractExampleSnippets(t *testing.T) { + t.Skip("only for debugging purpose") + + example, err := os.ReadFile("../../../golangci-lint/.golangci.example.yml") + require.NoError(t, err) + + m, err := extractExampleSnippets(example) + require.NoError(t, err) + + t.Log(m) +} diff --git a/test/bench/bench_test.go b/test/bench/bench_test.go index 9cf73f0abf00..4b43ff89b31a 100644 --- a/test/bench/bench_test.go +++ b/test/bench/bench_test.go @@ -71,7 +71,7 @@ func printCommand(cmd string, args ...string) { if os.Getenv("PRINT_CMD") != "1" { return } - quotedArgs := []string{} + var quotedArgs []string for _, a := range args { quotedArgs = append(quotedArgs, strconv.Quote(a)) } diff --git a/test/fix_test.go b/test/fix_test.go index 644a7d0bd426..3d1144d5e6d7 100644 --- a/test/fix_test.go +++ b/test/fix_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" + "github.com/golangci/golangci-lint/pkg/exitcodes" "github.com/golangci/golangci-lint/test/testshared" ) @@ -52,7 +53,19 @@ func TestFix(t *testing.T) { cfg, err := yaml.Marshal(rc.config) require.NoError(t, err) - testshared.NewLintRunner(t).RunWithYamlConfig(string(cfg), args...) + var runResult *testshared.RunResult + if rc.configPath != "" { + args = append(args, "-c", rc.configPath) + runResult = testshared.NewLintRunner(t).RunCommand("run", args...) + } else { + runResult = testshared.NewLintRunner(t).RunWithYamlConfig(string(cfg), args...) + } + + // nolintlint test uses non existing linters (bob, alice) + if rc.expectedLinter != "nolintlint" { + runResult.ExpectExitCode(exitcodes.Success) + } + output, err := os.ReadFile(input) require.NoError(t, err) diff --git a/test/linters_test.go b/test/linters_test.go index 4431a2882122..bb19e212a52c 100644 --- a/test/linters_test.go +++ b/test/linters_test.go @@ -2,8 +2,10 @@ package test import ( "bufio" + "fmt" "os" "os/exec" + "path" "path/filepath" "strings" "testing" @@ -97,6 +99,64 @@ func TestGciLocal(t *testing.T) { ExpectHasIssue("testdata/gci/gci.go:7: File is not `gci`-ed") } +func TestMultipleOutputs(t *testing.T) { + sourcePath := filepath.Join(testdataDir, "gci", "gci.go") + args := []string{ + "--disable-all", "--print-issued-lines=false", "--print-linter-name=false", "--out-format=line-number,json:stdout", + sourcePath, + } + rc := extractRunContextFromComments(t, sourcePath) + args = append(args, rc.args...) + + cfg, err := yaml.Marshal(rc.config) + require.NoError(t, err) + + testshared.NewLintRunner(t).RunWithYamlConfig(string(cfg), args...). + ExpectHasIssue("testdata/gci/gci.go:7: File is not `gci`-ed"). + ExpectOutputContains(`"Issues":[`) +} + +func TestStderrOutput(t *testing.T) { + sourcePath := filepath.Join(testdataDir, "gci", "gci.go") + args := []string{ + "--disable-all", "--print-issued-lines=false", "--print-linter-name=false", "--out-format=line-number,json:stderr", + sourcePath, + } + rc := extractRunContextFromComments(t, sourcePath) + args = append(args, rc.args...) + + cfg, err := yaml.Marshal(rc.config) + require.NoError(t, err) + + testshared.NewLintRunner(t).RunWithYamlConfig(string(cfg), args...). + ExpectHasIssue("testdata/gci/gci.go:7: File is not `gci`-ed"). + ExpectOutputContains(`"Issues":[`) +} + +func TestFileOutput(t *testing.T) { + resultPath := path.Join(t.TempDir(), "golangci_lint_test_result") + + sourcePath := filepath.Join(testdataDir, "gci", "gci.go") + args := []string{ + "--disable-all", "--print-issued-lines=false", "--print-linter-name=false", + fmt.Sprintf("--out-format=json:%s,line-number", resultPath), + sourcePath, + } + rc := extractRunContextFromComments(t, sourcePath) + args = append(args, rc.args...) + + cfg, err := yaml.Marshal(rc.config) + require.NoError(t, err) + + testshared.NewLintRunner(t).RunWithYamlConfig(string(cfg), args...). + ExpectHasIssue("testdata/gci/gci.go:7: File is not `gci`-ed"). + ExpectOutputNotContains(`"Issues":[`) + + b, err := os.ReadFile(resultPath) + require.NoError(t, err) + require.Contains(t, string(b), `"Issues":[`) +} + func saveConfig(t *testing.T, cfg map[string]interface{}) (cfgPath string, finishFunc func()) { f, err := os.CreateTemp("", "golangci_lint_test") require.NoError(t, err) diff --git a/test/ruleguard/rangeExprCopy.go b/test/ruleguard/rangeExprCopy.go new file mode 100644 index 000000000000..d68b45e61158 --- /dev/null +++ b/test/ruleguard/rangeExprCopy.go @@ -0,0 +1,14 @@ +// go:build ruleguard +package ruleguard + +import ( + "github.com/quasilyte/go-ruleguard/dsl" +) + +func RangeExprVal(m dsl.Matcher) { + m.Match(`for _, $_ := range $x { $*_ }`, `for _, $_ = range $x { $*_ }`). + Where(m["x"].Addressable && m["x"].Type.Size >= 512). + Report(`$x copy can be avoided with &$x`). + At(m["x"]). + Suggest(`&$x`) +} diff --git a/test/testdata/configs/decorder.yml b/test/testdata/configs/decorder.yml new file mode 100644 index 000000000000..0ef8e49b3976 --- /dev/null +++ b/test/testdata/configs/decorder.yml @@ -0,0 +1,10 @@ +linters-settings: + decorder: + dec-order: + - type + - const + - var + - func + disable-dec-order-check: false + disable-init-func-first-check: false + disable-dec-num-check: false diff --git a/test/testdata/configs/depguard_additional_guards.yml b/test/testdata/configs/depguard_additional_guards.yml new file mode 100644 index 000000000000..099edc4600b3 --- /dev/null +++ b/test/testdata/configs/depguard_additional_guards.yml @@ -0,0 +1,16 @@ +linters-settings: + depguard: + list-type: denylist + include-go-root: true + packages: + - compress/* + packages-with-error-message: + log: "don't use log" + additional-guards: + - list-type: denylist + include-go-root: true + packages: + - fmt + packages-with-error-message: + strings: "disallowed in additional guard" + diff --git a/test/testdata/configs/depguard_ignore_file_rules.yml b/test/testdata/configs/depguard_ignore_file_rules.yml new file mode 100644 index 000000000000..2fe4b023e8e2 --- /dev/null +++ b/test/testdata/configs/depguard_ignore_file_rules.yml @@ -0,0 +1,10 @@ +linters-settings: + depguard: + list-type: denylist + include-go-root: true + packages: + - compress/* + packages-with-error-message: + log: "don't use log" + ignore-file-rules: + - "**/*_ignore_file_rules.go" diff --git a/test/testdata/configs/errchkjson.yml b/test/testdata/configs/errchkjson.yml new file mode 100644 index 000000000000..d7d534574241 --- /dev/null +++ b/test/testdata/configs/errchkjson.yml @@ -0,0 +1,2 @@ +issues: + max-issues-per-linter: 100 diff --git a/test/testdata/configs/errchkjson_check_error_free_encoding.yml b/test/testdata/configs/errchkjson_check_error_free_encoding.yml new file mode 100644 index 000000000000..0186bef7de95 --- /dev/null +++ b/test/testdata/configs/errchkjson_check_error_free_encoding.yml @@ -0,0 +1,5 @@ +issues: + max-issues-per-linter: 100 +linters-settings: + errchkjson: + check-error-free-encoding: true diff --git a/test/testdata/configs/errchkjson_no_exported.yml b/test/testdata/configs/errchkjson_no_exported.yml new file mode 100644 index 000000000000..b62e297c6160 --- /dev/null +++ b/test/testdata/configs/errchkjson_no_exported.yml @@ -0,0 +1,3 @@ +linters-settings: + errchkjson: + report-no-exported: true diff --git a/test/testdata/configs/exhaustive_ignore_enum_members.yml b/test/testdata/configs/exhaustive_ignore_enum_members.yml new file mode 100644 index 000000000000..d5b8e2166d9f --- /dev/null +++ b/test/testdata/configs/exhaustive_ignore_enum_members.yml @@ -0,0 +1,3 @@ +linters-settings: + exhaustive: + ignore-enum-members: "West$" diff --git a/test/testdata/configs/forbidigo.yml b/test/testdata/configs/forbidigo.yml index 561e46d53cc4..11efcefad859 100644 --- a/test/testdata/configs/forbidigo.yml +++ b/test/testdata/configs/forbidigo.yml @@ -2,3 +2,4 @@ linters-settings: forbidigo: forbid: - fmt\.Print.* + - time.Sleep(# no sleeping!)? diff --git a/test/testdata/configs/gocritic-fix.yml b/test/testdata/configs/gocritic-fix.yml new file mode 100644 index 000000000000..5ea41749a5de --- /dev/null +++ b/test/testdata/configs/gocritic-fix.yml @@ -0,0 +1,8 @@ +linters-settings: + gocritic: + enabled-checks: + - ruleguard + settings: + ruleguard: + rules: 'ruleguard/rangeExprCopy.go,ruleguard/strings_simplify.go' + diff --git a/test/testdata/configs/maintidx_under_100.yml b/test/testdata/configs/maintidx_under_100.yml new file mode 100644 index 000000000000..8d54963412e7 --- /dev/null +++ b/test/testdata/configs/maintidx_under_100.yml @@ -0,0 +1,3 @@ +linters-settings: + maintidx: + under: 100 diff --git a/test/testdata/containedctx.go b/test/testdata/containedctx.go new file mode 100644 index 000000000000..ef8fc9fce6db --- /dev/null +++ b/test/testdata/containedctx.go @@ -0,0 +1,15 @@ +// args: -Econtainedctx +package testdata + +import "context" + +type ok struct { + i int + s string +} + +type ng struct { + ctx context.Context // ERROR "found a struct that contains a context.Context field" +} + +type empty struct{} diff --git a/test/testdata/decorder.go b/test/testdata/decorder.go new file mode 100644 index 000000000000..5cc325cce2e4 --- /dev/null +++ b/test/testdata/decorder.go @@ -0,0 +1,21 @@ +// args: -Edecorder +// config_path: testdata/configs/decorder.yml +package testdata + +import "math" + +const ( + decoc = math.MaxInt64 + decod = 1 +) + +var decoa = 1 +var decob = 1 // ERROR "multiple \"var\" declarations are not allowed; use parentheses instead" + +type decoe int // ERROR "type must not be placed after const" + +func decof() { + const decog = 1 +} + +func init() {} // ERROR "init func must be the first function in file" diff --git a/test/testdata/decorder_default.go b/test/testdata/decorder_default.go new file mode 100644 index 000000000000..69e85a7dac10 --- /dev/null +++ b/test/testdata/decorder_default.go @@ -0,0 +1,20 @@ +// args: -Edecorder +package testdata + +import "math" + +const ( + decoh = math.MaxInt64 + decoi = 1 +) + +var decoj = 1 +var decok = 1 + +type decol int + +func decom() { + const decon = 1 +} + +func init() {} diff --git a/test/testdata/depguard_additional_guards.go b/test/testdata/depguard_additional_guards.go new file mode 100644 index 000000000000..56679c090f07 --- /dev/null +++ b/test/testdata/depguard_additional_guards.go @@ -0,0 +1,16 @@ +//args: -Edepguard +//config_path: testdata/configs/depguard_additional_guards.yml +package testdata + +import ( + "compress/gzip" // ERROR "`compress/gzip` is in the blacklist" + "fmt" // ERROR "`fmt` is in the blacklist" + "log" // ERROR "`log` is in the blacklist: don't use log" + "strings" // ERROR "`strings` is in the blacklist: disallowed in additional guard" +) + +func SpewDebugInfo() { + log.Println(gzip.BestCompression) + log.Println(fmt.Sprintf("SpewDebugInfo")) + log.Println(strings.ToLower("SpewDebugInfo")) +} diff --git a/test/testdata/depguard_ignore_file_rules.go b/test/testdata/depguard_ignore_file_rules.go new file mode 100644 index 000000000000..e5131cb7b421 --- /dev/null +++ b/test/testdata/depguard_ignore_file_rules.go @@ -0,0 +1,13 @@ +//args: -Edepguard +//config_path: testdata/configs/depguard_ignore_file_rules.yml +package testdata + +// NOTE - No lint errors becuase this file is ignored +import ( + "compress/gzip" + "log" +) + +func SpewDebugInfo() { + log.Println(gzip.BestCompression) +} diff --git a/test/testdata/errchkjson.go b/test/testdata/errchkjson.go new file mode 100644 index 000000000000..e35a29454320 --- /dev/null +++ b/test/testdata/errchkjson.go @@ -0,0 +1,641 @@ +// args: -Eerrchkjson +// config_path: testdata/configs/errchkjson.yml +package testdata + +import ( + "encoding" + "encoding/json" + "fmt" + "io/ioutil" + "unsafe" +) + +type marshalText struct{} + +func (mt marshalText) MarshalText() ([]byte, error) { + return []byte(`mt`), nil +} + +var _ encoding.TextMarshaler = marshalText(struct{}{}) + +// JSONMarshalSafeTypesWithNoSafe contains a multitude of test cases to marshal different combinations of types to JSON, +// that are safe, that is, they will never return an error, if these types are marshaled to JSON. +func JSONMarshalSafeTypesWithNoSafe() { + var err error + + _, _ = json.Marshal(nil) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + json.Marshal(nil) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(nil) // nil is safe and check-error-free-encoding is false + _ = err + + _, _ = json.MarshalIndent(nil, "", " ") // ERROR "Error return value of `encoding/json.MarshalIndent` is not checked" + json.MarshalIndent(nil, "", " ") // ERROR "Error return value of `encoding/json.MarshalIndent` is not checked" + _, err = json.MarshalIndent(nil, "", " ") // nil is safe and check-error-free-encoding is false + _ = err + + enc := json.NewEncoder(ioutil.Discard) + _ = enc.Encode(nil) // ERROR "Error return value of `\\([*]encoding/json.Encoder\\).Encode` is not checked" + enc.Encode(nil) // ERROR "Error return value of `\\([*]encoding/json.Encoder\\).Encode` is not checked" + err = enc.Encode(nil) // nil is safe and check-error-free-encoding is false + _ = err + + var b bool + _, _ = json.Marshal(b) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(b) // bool is safe and check-error-free-encoding is false + _ = err + + var i int + _, _ = json.Marshal(i) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(i) // int is safe and check-error-free-encoding is false + _ = err + + var i8 int8 + _, _ = json.Marshal(i8) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(i8) // int8 is safe and check-error-free-encoding is false + _ = err + + var i16 int16 + _, _ = json.Marshal(i16) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(i16) // int16 is safe and check-error-free-encoding is false + _ = err + + var i32 int32 + _, _ = json.Marshal(i32) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(i32) // int32 / rune is safe and check-error-free-encoding is false + _ = err + + var i64 int64 + _, _ = json.Marshal(i64) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(i64) // int64 is safe and check-error-free-encoding is false + _ = err + + var ui uint + _, _ = json.Marshal(ui) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(ui) // uint is safe and check-error-free-encoding is false + _ = err + + var ui8 uint8 + _, _ = json.Marshal(ui8) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(ui8) // uint8 is safe and check-error-free-encoding is false + _ = err + + var ui16 uint16 + _, _ = json.Marshal(ui16) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(ui16) // uint16 is safe and check-error-free-encoding is false + _ = err + + var ui32 uint32 + _, _ = json.Marshal(ui32) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(ui32) // uint32 is safe and check-error-free-encoding is false + _ = err + + var ui64 uint64 + _, _ = json.Marshal(ui64) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(ui64) // uint64 is safe and check-error-free-encoding is false + _ = err + + var uiptr uintptr + _, _ = json.Marshal(uiptr) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(uiptr) // uintptr is safe and check-error-free-encoding is false + _ = err + + var str string + _, _ = json.Marshal(str) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(str) // string is safe and check-error-free-encoding is false + _ = err + + var strSlice []string + _, _ = json.Marshal(strSlice) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(strSlice) // []string is safe and check-error-free-encoding is false + _ = err + + var intSlice []int + _, _ = json.Marshal(intSlice) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(intSlice) // []int is safe and check-error-free-encoding is false + _ = err + + var boolSlice []bool + _, _ = json.Marshal(boolSlice) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(boolSlice) // []bool is safe and check-error-free-encoding is false + _ = err + + var strArray [10]string + _, _ = json.Marshal(strArray) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(strArray) // [10]string is safe and check-error-free-encoding is false + _ = err + + var intArray [10]int + _, _ = json.Marshal(intArray) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(intArray) // [10]int is safe and check-error-free-encoding is false + _ = err + + var boolArray [10]bool + _, _ = json.Marshal(boolArray) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(boolArray) // [10]bool is safe and check-error-free-encoding is false + _ = err + + var basicStruct struct { + Bool bool + Int int + Int8 int8 + Int16 int16 + Int32 int32 // also rune + Int64 int64 + Uint uint + Uint8 uint8 // also byte + Uint16 uint16 + Uint32 uint32 + Uint64 uint64 + Uintptr uintptr + String string + } + _, _ = json.Marshal(basicStruct) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(basicStruct) // struct containing only safe basic types is safe and check-error-free-encoding is false + _ = err + + var ptrStruct struct { + Bool *bool + Int *int + Int8 *int8 + Int16 *int16 + Int32 *int32 + Int64 *int64 + Uint *uint + Uint8 *uint8 + Uint16 *uint16 + Uint32 *uint32 + Uint64 *uint64 + Uintptr *uintptr + String *string + } + _, _ = json.Marshal(ptrStruct) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(ptrStruct) // struct containing pointer to only safe basic types is safe and check-error-free-encoding is false + _ = err + + var mapStrStr map[string]string + _, _ = json.Marshal(mapStrStr) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(mapStrStr) // map[string]string is safe and check-error-free-encoding is false + _ = err + + var mapStrInt map[string]int + _, _ = json.Marshal(mapStrInt) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(mapStrInt) // map[string]int is safe and check-error-free-encoding is false + _ = err + + var mapStrBool map[string]bool + _, _ = json.Marshal(mapStrBool) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(mapStrBool) // map[string]bool is safe and check-error-free-encoding is false + _ = err + + var mapIntStr map[int]string + _, _ = json.Marshal(mapIntStr) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(mapIntStr) // map[int]string is safe and check-error-free-encoding is false + _ = err + + var mapIntInt map[int]int + _, _ = json.Marshal(mapIntInt) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(mapIntInt) // map[int]int is safe and check-error-free-encoding is false + _ = err + + var mapIntBool map[int]bool + _, _ = json.Marshal(mapIntBool) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(mapIntBool) // map[int]bool is safe and check-error-free-encoding is false + _ = err + + type innerStruct struct { + Bool bool + Int int + String string + + StrSlice []string + IntSlice []int + BoolSlice []bool + + StrArray [10]string + IntArray [10]int + BoolArray [10]bool + + MapStrStr map[string]string + MapStrInt map[string]int + MapStrBool map[string]bool + + MapIntStr map[int]string + MapIntInt map[int]int + MapIntBool map[int]bool + } + var outerStruct struct { + Bool bool + Int int + String string + + StrSlice []string + IntSlice []int + BoolSlice []bool + + StrArray [10]string + IntArray [10]int + BoolArray [10]bool + + MapStrStr map[string]string + MapStrInt map[string]int + MapStrBool map[string]bool + + MapIntStr map[int]string + MapIntInt map[int]int + MapIntBool map[int]bool + + InnerStruct innerStruct + } + _, _ = json.Marshal(outerStruct) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(outerStruct) // struct with only safe types is safe and check-error-free-encoding is false + _ = err +} + +type ( + structKey struct{ id int } + ExportedUnsafeAndInvalidStruct struct { // unsafe unexported but omitted + F64 float64 + F64Ptr *float64 + F64Slice []float64 + F64Array [10]float64 + MapStrF64 map[string]float64 + MapEIStr map[interface{}]string + Number json.Number + NumberPtr *json.Number + NumberSlice []json.Number + MapNumberStr map[json.Number]string + Ei interface{} + Stringer fmt.Stringer + Mt marshalText + MapMarshalTextString map[marshalText]string + + C128 complex128 + C128Ptr *complex128 + C128Slice []complex128 + C128Array [10]complex128 + MapBoolStr map[bool]string + MapF64Str map[float64]string + F func() + Ch chan struct{} + UnsafePtr unsafe.Pointer + MapStructStr map[structKey]string + } +) + +// JSONMarshalSafeStructWithUnexportedFieldsWithNoSafe contains a struct with unexported, unsafe fields. +func JSONMarshalSaveStructWithUnexportedFieldsWithNoSafe() { + var err error + + var unexportedInStruct struct { + Bool bool // safe exported + + f64 float64 // unsafe unexported + f64Ptr *float64 // unsafe unexported + f64Slice []float64 // unsafe unexported + f64Array [10]float64 // unsafe unexported + mapStrF64 map[string]float64 // unsafe unexported + mapEIStr map[interface{}]string // unsafe unexported + number json.Number // unsafe unexported + numberPtr *json.Number // unsafe unexported + numberSlice []json.Number // unsafe unexported + mapNumberStr map[json.Number]string // unsafe unexported + ei interface{} // unsafe unexported + stringer fmt.Stringer // unsafe unexported + mt marshalText // unsafe unexported + mapMarshalTextString map[marshalText]string // unsafe unexported + unexportedStruct ExportedUnsafeAndInvalidStruct // unsafe unexported + unexportedStructPtr *ExportedUnsafeAndInvalidStruct // unsafe unexported + + c128 complex128 // invalid unexported + c128Slice []complex128 // invalid unexported + c128Array [10]complex128 // invalid unexported + mapBoolStr map[bool]string // invalid unexported + mapF64Str map[float64]string // invalid unexported + f func() // invalid unexported + ch chan struct{} // invalid unexported + unsafePtr unsafe.Pointer // invalid unexported + mapStructStr map[structKey]string // invalid unexported + } + _ = unexportedInStruct.f64 + _ = unexportedInStruct.f64Ptr + _ = unexportedInStruct.f64Slice + _ = unexportedInStruct.f64Array + _ = unexportedInStruct.mapStrF64 + _ = unexportedInStruct.mapEIStr + _ = unexportedInStruct.number + _ = unexportedInStruct.numberPtr + _ = unexportedInStruct.numberSlice + _ = unexportedInStruct.mapNumberStr + _ = unexportedInStruct.ei + _ = unexportedInStruct.stringer + _ = unexportedInStruct.mt + _ = unexportedInStruct.mapMarshalTextString + _ = unexportedInStruct.unexportedStruct + _ = unexportedInStruct.unexportedStructPtr + + _ = unexportedInStruct.c128 + _ = unexportedInStruct.c128Slice + _ = unexportedInStruct.c128Array + _ = unexportedInStruct.mapBoolStr + _ = unexportedInStruct.mapF64Str + _ = unexportedInStruct.f + _ = unexportedInStruct.ch + _ = unexportedInStruct.unsafePtr + _ = unexportedInStruct.mapStructStr[structKey{1}] + _, _ = json.Marshal(unexportedInStruct) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(unexportedInStruct) // struct containing unsafe but unexported fields is safe + _ = err +} + +// JSONMarshalSafeStructWithOmittedFieldsWithNoSafe contains a struct with omitted, unsafe fields. +func JSONMarshalSaveStructWithOmittedFieldsWithNoSafe() { + var err error + + var omitInStruct struct { + Bool bool // safe exported + + F64 float64 `json:"-"` // unsafe exported but omitted + F64Ptr *float64 `json:"-"` // unsafe exported but omitted + F64Slice []float64 `json:"-"` // unsafe exported but omitted + F64Array [10]float64 `json:"-"` // unsafe exported but omitted + MapStrF64 map[string]float64 `json:"-"` // unsafe exported but omitted + MapEIStr map[interface{}]string `json:"-"` // unsafe exported but omitted + Number json.Number `json:"-"` // unsafe exported but omitted + NumberPtr *json.Number `json:"-"` // unsafe exported but omitted + NumberSlice []json.Number `json:"-"` // unsafe exported but omitted + MapNumberStr map[json.Number]string `json:"-"` // unsafe exported but omitted + Ei interface{} `json:"-"` // unsafe exported but omitted + Stringer fmt.Stringer `json:"-"` // unsafe exported but omitted + Mt marshalText `json:"-"` // unsafe exported but omitted + MapMarshalTextString map[marshalText]string `json:"-"` // unsafe exported but omitted + ExportedStruct ExportedUnsafeAndInvalidStruct `json:"-"` // unsafe exported but omitted + ExportedStructPtr *ExportedUnsafeAndInvalidStruct `json:"-"` // unsafe exported but omitted + + C128 complex128 `json:"-"` // invalid exported but omitted + C128Slice []complex128 `json:"-"` // invalid exported but omitted + C128Array [10]complex128 `json:"-"` // invalid exported but omitted + MapBoolStr map[bool]string `json:"-"` // invalid exported but omitted + MapF64Str map[float64]string `json:"-"` // invalid exported but omitted + F func() `json:"-"` // invalid exported but omitted + Ch chan struct{} `json:"-"` // invalid exported but omitted + UnsafePtr unsafe.Pointer `json:"-"` // invalid exported but omitted + MapStructStr map[structKey]string `json:"-"` // invalid exported but omitted + } + _ = omitInStruct.MapStructStr[structKey{1}] + _, _ = json.Marshal(omitInStruct) // ERROR "Error return value of `encoding/json.Marshal` is not checked" + _, err = json.Marshal(omitInStruct) // struct containing unsafe but omitted, exported fields is safe and check-error-free-encoding is false + _ = err +} + +// JSONMarshalUnsafeTypes contains a multitude of test cases to marshal different combinations of types to JSON, +// that can potentially lead to json.Marshal returning an error. +func JSONMarshalUnsafeTypes() { + var err error + + var f32 float32 + json.Marshal(f32) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, _ = json.Marshal(f32) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(f32) // err is checked + _ = err + + var f64 float64 + _, _ = json.Marshal(f64) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(f64) // err is checked + _ = err + + var f32Slice []float32 + _, _ = json.Marshal(f32Slice) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(f32Slice) // err is checked + _ = err + + var f64Slice []float64 + _, _ = json.Marshal(f64Slice) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(f64Slice) // err is checked + _ = err + + var f32Array [10]float32 + _, _ = json.Marshal(f32Array) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(f32Array) // err is checked + _ = err + + var f64Array [10]float64 + _, _ = json.Marshal(f64Array) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(f64Array) // err is checked + _ = err + + var structPtrF32 struct { + F32 *float32 + } + _, _ = json.Marshal(structPtrF32) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(structPtrF32) // err is checked + _ = err + + var structPtrF64 struct { + F64 *float64 + } + _, _ = json.Marshal(structPtrF64) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(structPtrF64) // err is checked + _ = err + + var mapStrF32 map[string]float32 + _, _ = json.Marshal(mapStrF32) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(mapStrF32) // err is checked + _ = err + + var mapStrF64 map[string]float64 + _, _ = json.Marshal(mapStrF64) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(mapStrF64) // err is checked + _ = err + + var mapEIStr map[interface{}]string + _, _ = json.Marshal(mapEIStr) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` as map key found" + _, err = json.Marshal(mapEIStr) // err is checked + _ = err + + var mapStringerStr map[fmt.Stringer]string + _, _ = json.Marshal(mapStringerStr) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `fmt.Stringer` as map key found" + _, err = json.Marshal(mapStringerStr) // err is checked + _ = err + + var number json.Number + _, _ = json.Marshal(number) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `encoding/json.Number` found" + _, err = json.Marshal(number) // err is checked + _ = err + + var numberSlice []json.Number + _, _ = json.Marshal(numberSlice) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `encoding/json.Number` found" + _, err = json.Marshal(numberSlice) // err is checked + _ = err + + var mapNumberStr map[json.Number]string + _, _ = json.Marshal(mapNumberStr) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `encoding/json.Number` as map key found" + _, err = json.Marshal(mapNumberStr) // err is checked + _ = err + + var mapStrNumber map[string]json.Number + _, _ = json.Marshal(mapStrNumber) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `encoding/json.Number` found" + _, err = json.Marshal(mapStrNumber) // err is checked + _ = err + + var ei interface{} + _, _ = json.Marshal(ei) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found" + _, err = json.Marshal(ei) // err is checked + _ = err + + var eiptr *interface{} + _, _ = json.Marshal(eiptr) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `*interface{}` found" + _, err = json.Marshal(eiptr) // err is checked + _ = err + + var stringer fmt.Stringer + _, _ = json.Marshal(stringer) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `fmt.Stringer` found" + _, err = json.Marshal(stringer) // err is checked + _ = err + + var structWithEmptyInterface struct { + EmptyInterface interface{} + } + _, _ = json.Marshal(structWithEmptyInterface) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found" + _, err = json.Marshal(structWithEmptyInterface) // err is checked + _ = err + + var mt marshalText + _, _ = json.Marshal(mt) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `[a-z-]+.marshalText` found" + _, err = json.Marshal(mt) // err is checked + _ = err + + var mapMarshalTextString map[marshalText]string + _, _ = json.Marshal(mapMarshalTextString) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `[a-z-]+.marshalText` as map key found" + _, err = json.Marshal(mapMarshalTextString) // err is checked + _ = err +} + +// JSONMarshalInvalidTypes contains a multitude of test cases to marshal different combinations of types to JSON, +// that are invalid and not supported by json.Marshal, that is they will always return an error, if these types used +// with json.Marshal. +func JSONMarshalInvalidTypes() { + var err error + + var c64 complex64 + json.Marshal(c64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, _ = json.Marshal(c64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, err = json.Marshal(c64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _ = err + + var c128 complex128 + _, _ = json.Marshal(c128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _, err = json.Marshal(c128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _ = err + + var sliceC64 []complex64 + _, _ = json.Marshal(sliceC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, err = json.Marshal(sliceC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _ = err + + var sliceC128 []complex128 + _, _ = json.Marshal(sliceC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _, err = json.Marshal(sliceC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _ = err + + var arrayC64 []complex64 + _, _ = json.Marshal(arrayC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, err = json.Marshal(arrayC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _ = err + + var arrayC128 []complex128 + _, _ = json.Marshal(arrayC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _, err = json.Marshal(arrayC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _ = err + + var structPtrC64 struct { + C64 *complex64 + } + _, _ = json.Marshal(structPtrC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, err = json.Marshal(structPtrC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _ = err + + var structPtrC128 struct { + C128 *complex128 + } + _, _ = json.Marshal(structPtrC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _, err = json.Marshal(structPtrC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _ = err + + var mapBoolStr map[bool]string + _, _ = json.Marshal(mapBoolStr) // ERROR "`encoding/json.Marshal` for unsupported type `bool` as map key found" + _, err = json.Marshal(mapBoolStr) // ERROR "`encoding/json.Marshal` for unsupported type `bool` as map key found" + _ = err + + var mapF32Str map[float32]string + _, _ = json.Marshal(mapF32Str) // ERROR "`encoding/json.Marshal` for unsupported type `float32` as map key found" + _, err = json.Marshal(mapF32Str) // ERROR "`encoding/json.Marshal` for unsupported type `float32` as map key found" + _ = err + + var mapF64Str map[float64]string + _, _ = json.Marshal(mapF64Str) // ERROR "`encoding/json.Marshal` for unsupported type `float64` as map key found" + _, err = json.Marshal(mapF64Str) // ERROR "`encoding/json.Marshal` for unsupported type `float64` as map key found" + _ = err + + var mapC64Str map[complex64]string + _, _ = json.Marshal(mapC64Str) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` as map key found" + _, err = json.Marshal(mapC64Str) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` as map key found" + _ = err + + var mapC128Str map[complex128]string + _, _ = json.Marshal(mapC128Str) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` as map key found" + _, err = json.Marshal(mapC128Str) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` as map key found" + _ = err + + mapStructStr := map[structKey]string{structKey{1}: "str"} + _, _ = json.Marshal(mapStructStr) // ERROR "`encoding/json.Marshal` for unsupported type `[a-z-]+.structKey` as map key found" + _, err = json.Marshal(mapStructStr) // ERROR "`encoding/json.Marshal` for unsupported type `[a-z-]+.structKey` as map key found" + _ = err + + f := func() {} + _, _ = json.Marshal(f) // ERROR "`encoding/json.Marshal` for unsupported type `func\\(\\)` found" + _, err = json.Marshal(f) // ERROR "`encoding/json.Marshal` for unsupported type `func\\(\\)` found" + _ = err + + var ch chan struct{} = make(chan struct{}) + _, _ = json.Marshal(ch) // ERROR "`encoding/json.Marshal` for unsupported type `chan struct{}` found" + _, err = json.Marshal(ch) // ERROR "`encoding/json.Marshal` for unsupported type `chan struct{}` found" + _ = err + + var unsafePtr unsafe.Pointer + _, _ = json.Marshal(unsafePtr) // ERROR "`encoding/json.Marshal` for unsupported type `unsafe.Pointer` found" + _, err = json.Marshal(unsafePtr) // ERROR "`encoding/json.Marshal` for unsupported type `unsafe.Pointer` found" + _ = err +} + +// NotJSONMarshal contains other go ast node types, that are not considered by errchkjson +func NotJSONMarshal() { + s := fmt.Sprintln("I am not considered by errchkjson") + _ = s + f := func() bool { return false } + _ = f() +} + +// JSONMarshalStructWithoutExportedFields contains a struct without exported fields. +func JSONMarshalStructWithoutExportedFields() { + var err error + + var withoutExportedFields struct { + privateField bool + ExportedButOmittedField bool `json:"-"` + } + _, err = json.Marshal(withoutExportedFields) // want "Error argument passed to `encoding/json.Marshal` does not contain any exported field" + _ = err +} + +// JSONMarshalStructWithoutExportedFields contains a struct without exported fields. +func JSONMarshalStructWithNestedStructWithoutExportedFields() { + var err error + + var withNestedStructWithoutExportedFields struct { + ExportedStruct struct { + privatField bool + } + } + _, err = json.Marshal(withNestedStructWithoutExportedFields) + _ = err +} diff --git a/test/testdata/errchkjson_check_error_free_encoding.go b/test/testdata/errchkjson_check_error_free_encoding.go new file mode 100644 index 000000000000..b16a4dcee541 --- /dev/null +++ b/test/testdata/errchkjson_check_error_free_encoding.go @@ -0,0 +1,616 @@ +// args: -Eerrchkjson +// config_path: testdata/configs/errchkjson_check_error_free_encoding.yml +package testdata + +import ( + "encoding" + "encoding/json" + "fmt" + "io/ioutil" + "unsafe" +) + +type marshalText struct{} + +func (mt marshalText) MarshalText() ([]byte, error) { + return []byte(`mt`), nil +} + +var _ encoding.TextMarshaler = marshalText(struct{}{}) + +// JSONMarshalSafeTypes contains a multitude of test cases to marshal different combinations of types to JSON, +// that are safe, that is, they will never return an error, if these types are marshaled to JSON. +func JSONMarshalSafeTypes() { + var err error + + _, _ = json.Marshal(nil) // nil is safe + json.Marshal(nil) // nil is safe + _, err = json.Marshal(nil) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + _, _ = json.MarshalIndent(nil, "", " ") // nil is safe + json.MarshalIndent(nil, "", " ") // nil is safe + _, err = json.MarshalIndent(nil, "", " ") // ERROR "Error return value of `encoding/json.MarshalIndent` is checked but passed argument is safe" + _ = err + + enc := json.NewEncoder(ioutil.Discard) + _ = enc.Encode(nil) // nil is safe + enc.Encode(nil) // nil is safe + err = enc.Encode(nil) // ERROR "Error return value of `\\([*]encoding/json.Encoder\\).Encode` is checked but passed argument is safe" + _ = err + + var b bool + _, _ = json.Marshal(b) // bool is safe + _, err = json.Marshal(b) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var i int + _, _ = json.Marshal(i) // int is safe + _, err = json.Marshal(i) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var i8 int8 + _, _ = json.Marshal(i8) // int8 is safe + _, err = json.Marshal(i8) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var i16 int16 + _, _ = json.Marshal(i16) // int16 is safe + _, err = json.Marshal(i16) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var i32 int32 + _, _ = json.Marshal(i32) // int32 / rune is safe + _, err = json.Marshal(i32) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var i64 int64 + _, _ = json.Marshal(i64) // int64 is safe + _, err = json.Marshal(i64) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var ui uint + _, _ = json.Marshal(ui) // uint is safe + _, err = json.Marshal(ui) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var ui8 uint8 + _, _ = json.Marshal(ui8) // uint8 / byte is safe + _, err = json.Marshal(ui8) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var ui16 uint16 + _, _ = json.Marshal(ui16) // uint16 is safe + _, err = json.Marshal(ui16) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var ui32 uint32 + _, _ = json.Marshal(ui32) // uint32 / rune is safe + _, err = json.Marshal(ui32) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var ui64 uint64 + _, _ = json.Marshal(ui64) // uint64 is safe + _, err = json.Marshal(ui64) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var uiptr uintptr + _, _ = json.Marshal(uiptr) // uintptr is safe + _, err = json.Marshal(uiptr) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var str string + _, _ = json.Marshal(str) // string is safe + _, err = json.Marshal(str) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var strSlice []string + _, _ = json.Marshal(strSlice) // []string is safe + _, err = json.Marshal(strSlice) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var intSlice []int + _, _ = json.Marshal(intSlice) // []int is safe + _, err = json.Marshal(intSlice) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var boolSlice []bool + _, _ = json.Marshal(boolSlice) // []bool is safe + _, err = json.Marshal(boolSlice) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var strArray [10]string + _, _ = json.Marshal(strArray) // [10]string is safe + _, err = json.Marshal(strArray) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var intArray [10]int + _, _ = json.Marshal(intArray) // [10]int is safe + _, err = json.Marshal(intArray) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var boolArray [10]bool + _, _ = json.Marshal(boolArray) // [10]bool is safe + _, err = json.Marshal(boolArray) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var basicStruct struct { + Bool bool + Int int + Int8 int8 + Int16 int16 + Int32 int32 // also rune + Int64 int64 + Uint uint + Uint8 uint8 // also byte + Uint16 uint16 + Uint32 uint32 + Uint64 uint64 + Uintptr uintptr + String string + } + _, _ = json.Marshal(basicStruct) // struct containing only safe basic types is safe + _, err = json.Marshal(basicStruct) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var ptrStruct struct { + Bool *bool + Int *int + Int8 *int8 + Int16 *int16 + Int32 *int32 + Int64 *int64 + Uint *uint + Uint8 *uint8 + Uint16 *uint16 + Uint32 *uint32 + Uint64 *uint64 + Uintptr *uintptr + String *string + } + _, _ = json.Marshal(ptrStruct) // struct containing pointer to only safe basic types is safe + _, err = json.Marshal(ptrStruct) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var mapStrStr map[string]string + _, _ = json.Marshal(mapStrStr) // map[string]string is safe + _, err = json.Marshal(mapStrStr) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var mapStrInt map[string]int + _, _ = json.Marshal(mapStrInt) // map[string]int is safe + _, err = json.Marshal(mapStrInt) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var mapStrBool map[string]bool + _, _ = json.Marshal(mapStrBool) // map[string]bool is safe + _, err = json.Marshal(mapStrBool) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var mapIntStr map[int]string + _, _ = json.Marshal(mapIntStr) // map[int]string is safe + _, err = json.Marshal(mapIntStr) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var mapIntInt map[int]int + _, _ = json.Marshal(mapIntInt) // map[int]int is safe + _, err = json.Marshal(mapIntInt) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + var mapIntBool map[int]bool + _, _ = json.Marshal(mapIntBool) // map[int]bool is safe + _, err = json.Marshal(mapIntBool) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err + + type innerStruct struct { + Bool bool + Int int + String string + + StrSlice []string + IntSlice []int + BoolSlice []bool + + StrArray [10]string + IntArray [10]int + BoolArray [10]bool + + MapStrStr map[string]string + MapStrInt map[string]int + MapStrBool map[string]bool + + MapIntStr map[int]string + MapIntInt map[int]int + MapIntBool map[int]bool + } + var outerStruct struct { + Bool bool + Int int + String string + + StrSlice []string + IntSlice []int + BoolSlice []bool + + StrArray [10]string + IntArray [10]int + BoolArray [10]bool + + MapStrStr map[string]string + MapStrInt map[string]int + MapStrBool map[string]bool + + MapIntStr map[int]string + MapIntInt map[int]int + MapIntBool map[int]bool + + InnerStruct innerStruct + } + _, _ = json.Marshal(outerStruct) // struct with only safe types + _, err = json.Marshal(outerStruct) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err +} + +type ( + structKey struct{ id int } + ExportedUnsafeAndInvalidStruct struct { // unsafe unexported but omitted + F64 float64 + F64Ptr *float64 + F64Slice []float64 + F64Array [10]float64 + MapStrF64 map[string]float64 + MapEIStr map[interface{}]string + Number json.Number + NumberPtr *json.Number + NumberSlice []json.Number + MapNumberStr map[json.Number]string + Ei interface{} + Stringer fmt.Stringer + Mt marshalText + MapMarshalTextString map[marshalText]string + + C128 complex128 + C128Ptr *complex128 + C128Slice []complex128 + C128Array [10]complex128 + MapBoolStr map[bool]string + MapF64Str map[float64]string + F func() + Ch chan struct{} + UnsafePtr unsafe.Pointer + MapStructStr map[structKey]string + } +) + +// JSONMarshalSaveStructWithUnexportedFields contains a struct with unexported, unsafe fields. +func JSONMarshalSaveStructWithUnexportedFields() { + var err error + + var unexportedInStruct struct { + Bool bool // safe exported + + f64 float64 // unsafe unexported + f64Ptr *float64 // unsafe unexported + f64Slice []float64 // unsafe unexported + f64Array [10]float64 // unsafe unexported + mapStrF64 map[string]float64 // unsafe unexported + mapEIStr map[interface{}]string // unsafe unexported + number json.Number // unsafe unexported + numberPtr *json.Number // unsafe unexported + numberSlice []json.Number // unsafe unexported + mapNumberStr map[json.Number]string // unsafe unexported + ei interface{} // unsafe unexported + stringer fmt.Stringer // unsafe unexported + mt marshalText // unsafe unexported + mapMarshalTextString map[marshalText]string // unsafe unexported + unexportedStruct ExportedUnsafeAndInvalidStruct // unsafe unexported + unexportedStructPtr *ExportedUnsafeAndInvalidStruct // unsafe unexported + + c128 complex128 // invalid unexported + c128Slice []complex128 // invalid unexported + c128Array [10]complex128 // invalid unexported + mapBoolStr map[bool]string // invalid unexported + mapF64Str map[float64]string // invalid unexported + f func() // invalid unexported + ch chan struct{} // invalid unexported + unsafePtr unsafe.Pointer // invalid unexported + mapStructStr map[structKey]string // invalid unexported + } + _ = unexportedInStruct.f64 + _ = unexportedInStruct.f64Ptr + _ = unexportedInStruct.f64Slice + _ = unexportedInStruct.f64Array + _ = unexportedInStruct.mapStrF64 + _ = unexportedInStruct.mapEIStr + _ = unexportedInStruct.number + _ = unexportedInStruct.numberPtr + _ = unexportedInStruct.numberSlice + _ = unexportedInStruct.mapNumberStr + _ = unexportedInStruct.ei + _ = unexportedInStruct.stringer + _ = unexportedInStruct.mt + _ = unexportedInStruct.mapMarshalTextString + _ = unexportedInStruct.unexportedStruct + _ = unexportedInStruct.unexportedStructPtr + + _ = unexportedInStruct.c128 + _ = unexportedInStruct.c128Slice + _ = unexportedInStruct.c128Array + _ = unexportedInStruct.mapBoolStr + _ = unexportedInStruct.mapF64Str + _ = unexportedInStruct.f + _ = unexportedInStruct.ch + _ = unexportedInStruct.unsafePtr + _ = unexportedInStruct.mapStructStr[structKey{1}] + _, _ = json.Marshal(unexportedInStruct) // struct containing unsafe but unexported fields is safe + _, err = json.Marshal(unexportedInStruct) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err +} + +// JSONMarshalSaveStructWithOmittedFields contains a struct with omitted, unsafe fields. +func JSONMarshalSaveStructWithOmittedFields() { + var err error + + var omitInStruct struct { + Bool bool // safe exported + + F64 float64 `json:"-"` // unsafe exported but omitted + F64Ptr *float64 `json:"-"` // unsafe exported but omitted + F64Slice []float64 `json:"-"` // unsafe exported but omitted + F64Array [10]float64 `json:"-"` // unsafe exported but omitted + MapStrF64 map[string]float64 `json:"-"` // unsafe exported but omitted + MapEIStr map[interface{}]string `json:"-"` // unsafe exported but omitted + Number json.Number `json:"-"` // unsafe exported but omitted + NumberPtr *json.Number `json:"-"` // unsafe exported but omitted + NumberSlice []json.Number `json:"-"` // unsafe exported but omitted + MapNumberStr map[json.Number]string `json:"-"` // unsafe exported but omitted + Ei interface{} `json:"-"` // unsafe exported but omitted + Stringer fmt.Stringer `json:"-"` // unsafe exported but omitted + Mt marshalText `json:"-"` // unsafe exported but omitted + MapMarshalTextString map[marshalText]string `json:"-"` // unsafe exported but omitted + ExportedStruct ExportedUnsafeAndInvalidStruct `json:"-"` // unsafe exported but omitted + ExportedStructPtr *ExportedUnsafeAndInvalidStruct `json:"-"` // unsafe exported but omitted + + C128 complex128 `json:"-"` // invalid exported but omitted + C128Slice []complex128 `json:"-"` // invalid exported but omitted + C128Array [10]complex128 `json:"-"` // invalid exported but omitted + MapBoolStr map[bool]string `json:"-"` // invalid exported but omitted + MapF64Str map[float64]string `json:"-"` // invalid exported but omitted + F func() `json:"-"` // invalid exported but omitted + Ch chan struct{} `json:"-"` // invalid exported but omitted + UnsafePtr unsafe.Pointer `json:"-"` // invalid exported but omitted + MapStructStr map[structKey]string `json:"-"` // invalid exported but omitted + } + _ = omitInStruct.MapStructStr[structKey{1}] + _, _ = json.Marshal(omitInStruct) // struct containing unsafe but omitted, exported fields is safe + _, err = json.Marshal(omitInStruct) // ERROR "Error return value of `encoding/json.Marshal` is checked but passed argument is safe" + _ = err +} + +// JSONMarshalUnsafeTypes contains a multitude of test cases to marshal different combinations of types to JSON, +// that can potentially lead to json.Marshal returning an error. +func JSONMarshalUnsafeTypes() { + var err error + + var f32 float32 + json.Marshal(f32) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, _ = json.Marshal(f32) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(f32) // err is checked + _ = err + + var f64 float64 + _, _ = json.Marshal(f64) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(f64) // err is checked + _ = err + + var f32Slice []float32 + _, _ = json.Marshal(f32Slice) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(f32Slice) // err is checked + _ = err + + var f64Slice []float64 + _, _ = json.Marshal(f64Slice) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(f64Slice) // err is checked + _ = err + + var f32Array [10]float32 + _, _ = json.Marshal(f32Array) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(f32Array) // err is checked + _ = err + + var f64Array [10]float64 + _, _ = json.Marshal(f64Array) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(f64Array) // err is checked + _ = err + + var structPtrF32 struct { + F32 *float32 + } + _, _ = json.Marshal(structPtrF32) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(structPtrF32) // err is checked + _ = err + + var structPtrF64 struct { + F64 *float64 + } + _, _ = json.Marshal(structPtrF64) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(structPtrF64) // err is checked + _ = err + + var mapStrF32 map[string]float32 + _, _ = json.Marshal(mapStrF32) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float32` found" + _, err = json.Marshal(mapStrF32) // err is checked + _ = err + + var mapStrF64 map[string]float64 + _, _ = json.Marshal(mapStrF64) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `float64` found" + _, err = json.Marshal(mapStrF64) // err is checked + _ = err + + var mapEIStr map[interface{}]string + _, _ = json.Marshal(mapEIStr) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` as map key found" + _, err = json.Marshal(mapEIStr) // err is checked + _ = err + + var mapStringerStr map[fmt.Stringer]string + _, _ = json.Marshal(mapStringerStr) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `fmt.Stringer` as map key found" + _, err = json.Marshal(mapStringerStr) // err is checked + _ = err + + var number json.Number + _, _ = json.Marshal(number) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `encoding/json.Number` found" + _, err = json.Marshal(number) // err is checked + _ = err + + var numberSlice []json.Number + _, _ = json.Marshal(numberSlice) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `encoding/json.Number` found" + _, err = json.Marshal(numberSlice) // err is checked + _ = err + + var mapNumberStr map[json.Number]string + _, _ = json.Marshal(mapNumberStr) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `encoding/json.Number` as map key found" + _, err = json.Marshal(mapNumberStr) // err is checked + _ = err + + var mapStrNumber map[string]json.Number + _, _ = json.Marshal(mapStrNumber) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `encoding/json.Number` found" + _, err = json.Marshal(mapStrNumber) // err is checked + _ = err + + var ei interface{} + _, _ = json.Marshal(ei) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found" + _, err = json.Marshal(ei) // err is checked + _ = err + + var eiptr *interface{} + _, _ = json.Marshal(eiptr) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `*interface{}` found" + _, err = json.Marshal(eiptr) // err is checked + _ = err + + var stringer fmt.Stringer + _, _ = json.Marshal(stringer) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `fmt.Stringer` found" + _, err = json.Marshal(stringer) // err is checked + _ = err + + var structWithEmptyInterface struct { + EmptyInterface interface{} + } + _, _ = json.Marshal(structWithEmptyInterface) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `interface{}` found" + _, err = json.Marshal(structWithEmptyInterface) // err is checked + _ = err + + var mt marshalText + _, _ = json.Marshal(mt) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `[a-z-]+.marshalText` found" + _, err = json.Marshal(mt) // err is checked + _ = err + + var mapMarshalTextString map[marshalText]string + _, _ = json.Marshal(mapMarshalTextString) // ERROR "Error return value of `encoding/json.Marshal` is not checked: unsafe type `[a-z-]+.marshalText` as map key found" + _, err = json.Marshal(mapMarshalTextString) // err is checked + _ = err +} + +// JSONMarshalInvalidTypes contains a multitude of test cases to marshal different combinations of types to JSON, +// that are invalid and not supported by json.Marshal, that is they will always return an error, if these types used +// with json.Marshal. +func JSONMarshalInvalidTypes() { + var err error + + var c64 complex64 + json.Marshal(c64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, _ = json.Marshal(c64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, err = json.Marshal(c64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _ = err + + var c128 complex128 + _, _ = json.Marshal(c128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _, err = json.Marshal(c128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _ = err + + var sliceC64 []complex64 + _, _ = json.Marshal(sliceC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, err = json.Marshal(sliceC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _ = err + + var sliceC128 []complex128 + _, _ = json.Marshal(sliceC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _, err = json.Marshal(sliceC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _ = err + + var arrayC64 []complex64 + _, _ = json.Marshal(arrayC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, err = json.Marshal(arrayC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _ = err + + var arrayC128 []complex128 + _, _ = json.Marshal(arrayC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _, err = json.Marshal(arrayC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _ = err + + var structPtrC64 struct { + C64 *complex64 + } + _, _ = json.Marshal(structPtrC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _, err = json.Marshal(structPtrC64) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` found" + _ = err + + var structPtrC128 struct { + C128 *complex128 + } + _, _ = json.Marshal(structPtrC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _, err = json.Marshal(structPtrC128) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` found" + _ = err + + var mapBoolStr map[bool]string + _, _ = json.Marshal(mapBoolStr) // ERROR "`encoding/json.Marshal` for unsupported type `bool` as map key found" + _, err = json.Marshal(mapBoolStr) // ERROR "`encoding/json.Marshal` for unsupported type `bool` as map key found" + _ = err + + var mapF32Str map[float32]string + _, _ = json.Marshal(mapF32Str) // ERROR "`encoding/json.Marshal` for unsupported type `float32` as map key found" + _, err = json.Marshal(mapF32Str) // ERROR "`encoding/json.Marshal` for unsupported type `float32` as map key found" + _ = err + + var mapF64Str map[float64]string + _, _ = json.Marshal(mapF64Str) // ERROR "`encoding/json.Marshal` for unsupported type `float64` as map key found" + _, err = json.Marshal(mapF64Str) // ERROR "`encoding/json.Marshal` for unsupported type `float64` as map key found" + _ = err + + var mapC64Str map[complex64]string + _, _ = json.Marshal(mapC64Str) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` as map key found" + _, err = json.Marshal(mapC64Str) // ERROR "`encoding/json.Marshal` for unsupported type `complex64` as map key found" + _ = err + + var mapC128Str map[complex128]string + _, _ = json.Marshal(mapC128Str) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` as map key found" + _, err = json.Marshal(mapC128Str) // ERROR "`encoding/json.Marshal` for unsupported type `complex128` as map key found" + _ = err + + mapStructStr := map[structKey]string{structKey{1}: "str"} + _, _ = json.Marshal(mapStructStr) // ERROR "`encoding/json.Marshal` for unsupported type `[a-z-]+.structKey` as map key found" + _, err = json.Marshal(mapStructStr) // ERROR "`encoding/json.Marshal` for unsupported type `[a-z-]+.structKey` as map key found" + _ = err + + f := func() {} + _, _ = json.Marshal(f) // ERROR "`encoding/json.Marshal` for unsupported type `func\\(\\)` found" + _, err = json.Marshal(f) // ERROR "`encoding/json.Marshal` for unsupported type `func\\(\\)` found" + _ = err + + var ch chan struct{} = make(chan struct{}) + _, _ = json.Marshal(ch) // ERROR "`encoding/json.Marshal` for unsupported type `chan struct{}` found" + _, err = json.Marshal(ch) // ERROR "`encoding/json.Marshal` for unsupported type `chan struct{}` found" + _ = err + + var unsafePtr unsafe.Pointer + _, _ = json.Marshal(unsafePtr) // ERROR "`encoding/json.Marshal` for unsupported type `unsafe.Pointer` found" + _, err = json.Marshal(unsafePtr) // ERROR "`encoding/json.Marshal` for unsupported type `unsafe.Pointer` found" + _ = err +} + +// NotJSONMarshal contains other go ast node types, that are not considered by errchkjson +func NotJSONMarshal() { + s := fmt.Sprintln("I am not considered by errchkjson") + _ = s + f := func() bool { return false } + _ = f() +} diff --git a/test/testdata/errchkjson_no_exported.go b/test/testdata/errchkjson_no_exported.go new file mode 100644 index 000000000000..97880f502899 --- /dev/null +++ b/test/testdata/errchkjson_no_exported.go @@ -0,0 +1,28 @@ +// args: -Eerrchkjson +// config_path: testdata/configs/errchkjson_no_exported.yml +package testdata + +import ( + "encoding/json" +) + +// JSONMarshalStructWithoutExportedFields contains a struct without exported fields. +func JSONMarshalStructWithoutExportedFields() { + var withoutExportedFields struct { + privateField bool + ExportedButOmittedField bool `json:"-"` + } + _, err := json.Marshal(withoutExportedFields) // ERROR "Error argument passed to `encoding/json.Marshal` does not contain any exported field" + _ = err +} + +// JSONMarshalStructWithNestedStructWithoutExportedFields contains a struct without exported fields. +func JSONMarshalStructWithNestedStructWithoutExportedFields() { + var withNestedStructWithoutExportedFields struct { + ExportedStruct struct { + privatField bool + } + } + _, err := json.Marshal(withNestedStructWithoutExportedFields) + _ = err +} diff --git a/test/testdata/exhaustive_default.go b/test/testdata/exhaustive_default.go index 1dc2637fd198..50898eba2469 100644 --- a/test/testdata/exhaustive_default.go +++ b/test/testdata/exhaustive_default.go @@ -11,6 +11,10 @@ const ( West ) +// Should not report missing cases in the switch statement below even though +// some enum members (East, West) are not listed, because the switch statement +// has a 'default' case and the default-signifies-exhaustive setting is true. + func processDirectionDefault(d Direction) { switch d { case North, South: diff --git a/test/testdata/exhaustive_ignore_enum_members.go b/test/testdata/exhaustive_ignore_enum_members.go new file mode 100644 index 000000000000..65bf8fc8d76f --- /dev/null +++ b/test/testdata/exhaustive_ignore_enum_members.go @@ -0,0 +1,21 @@ +//args: -Eexhaustive +//config_path: testdata/configs/exhaustive_ignore_enum_members.yml +package testdata + +type Direction int + +const ( + North Direction = iota + East + South + West +) + +// Should only report East as missing because the enum member West is ignored +// using the ignore-enum-members setting. + +func processDirectionIgnoreEnumMembers(d Direction) { + switch d { // ERROR "missing cases in switch of type Direction: East" + case North, South: + } +} diff --git a/test/testdata/fix/in/gocritic.go b/test/testdata/fix/in/gocritic.go new file mode 100644 index 000000000000..80a42b5812f6 --- /dev/null +++ b/test/testdata/fix/in/gocritic.go @@ -0,0 +1,21 @@ +// args: -Egocritic +// config_path: testdata/configs/gocritic-fix.yml +package p + +import ( + "strings" +) + +func gocritic() { + var xs [2048]byte + + // xs -> &xs + for _, x := range xs { + print(x) + } + + // strings.Count("foo", "bar") == 0 -> !strings.Contains("foo", "bar") + if strings.Count("foo", "bar") == 0 { + print("qu") + } +} diff --git a/test/testdata/fix/in/unused.go b/test/testdata/fix/in/unused.go deleted file mode 100644 index fa8979c2a53c..000000000000 --- a/test/testdata/fix/in/unused.go +++ /dev/null @@ -1,8 +0,0 @@ -//args: -Eunused -package p - -type ( - unused struct{} -) - -func X() {} diff --git a/test/testdata/fix/out/gocritic.go b/test/testdata/fix/out/gocritic.go new file mode 100644 index 000000000000..a4fa277d7d28 --- /dev/null +++ b/test/testdata/fix/out/gocritic.go @@ -0,0 +1,21 @@ +// args: -Egocritic +// config_path: testdata/configs/gocritic-fix.yml +package p + +import ( + "strings" +) + +func gocritic() { + var xs [2048]byte + + // xs -> &xs + for _, x := range &xs { + print(x) + } + + // strings.Count("foo", "bar") == 0 -> !strings.Contains("foo", "bar") + if !strings.Contains("foo", "bar") { + print("qu") + } +} diff --git a/test/testdata/fix/out/unused.go b/test/testdata/fix/out/unused.go deleted file mode 100644 index fa8979c2a53c..000000000000 --- a/test/testdata/fix/out/unused.go +++ /dev/null @@ -1,8 +0,0 @@ -//args: -Eunused -package p - -type ( - unused struct{} -) - -func X() {} diff --git a/test/testdata/forbidigo_example.go b/test/testdata/forbidigo_example.go index 5ac04676b795..3e7c3b95040a 100644 --- a/test/testdata/forbidigo_example.go +++ b/test/testdata/forbidigo_example.go @@ -2,8 +2,12 @@ //config_path: testdata/configs/forbidigo.yml package testdata -import "fmt" +import ( + "fmt" + "time" +) func Forbidigo() { - fmt.Printf("too noisy!!!") // ERROR "use of `fmt\\.Printf` forbidden by pattern `fmt\\\\.Print\\.\\*`" + fmt.Printf("too noisy!!!") // ERROR "use of `fmt\\.Printf` forbidden by pattern `fmt\\\\.Print\\.\\*`" + time.Sleep(time.Nanosecond) // ERROR "no sleeping!" } diff --git a/test/testdata/maintidx.go b/test/testdata/maintidx.go new file mode 100644 index 000000000000..51f95235040c --- /dev/null +++ b/test/testdata/maintidx.go @@ -0,0 +1,196 @@ +//args: -Emaintidx +package testdata + +func over20() { +} + +func under20() { // ERROR "Function name: under20, Cyclomatic Complexity: 76, Halstead Volume: 1636.00, Maintainability Index: 17" + for true { + if false { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } else if false { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } else if false { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } else if false { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } else { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } + } +} diff --git a/test/testdata/maintidx_under_100.go b/test/testdata/maintidx_under_100.go new file mode 100644 index 000000000000..ce80be08d667 --- /dev/null +++ b/test/testdata/maintidx_under_100.go @@ -0,0 +1,197 @@ +// args: -Emaintidx +// config_path: testdata/configs/maintidx_under_100.yml +package testdata + +func over20() { // ERROR "Function name: over20, Cyclomatic Complexity: 1, Halstead Volume: 8.00, Maintainability Index: 86" +} + +func under20() { // ERROR "Function name: under20, Cyclomatic Complexity: 76, Halstead Volume: 1636.00, Maintainability Index: 17" + for true { + if false { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } else if false { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } else if false { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } else if false { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } else { + if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else if false { + n := 0 + switch n { + case 0: + case 1: + default: + } + } else { + n := 0 + switch n { + case 0: + case 1: + default: + } + } + } + } +} diff --git a/test/testdata/makezero.go b/test/testdata/makezero.go index e0f47122d8df..40b2ef3cd806 100644 --- a/test/testdata/makezero.go +++ b/test/testdata/makezero.go @@ -8,6 +8,12 @@ func Makezero() []int { return append(x, 1) // ERROR "append to slice `x` with non-zero initialized length" } +func MakezeroMultiple() []int { + x, y := make([]int, math.MaxInt8), make([]int, math.MaxInt8) + return append(x, // ERROR "append to slice `x` with non-zero initialized length" + append(y, 1)...) // ERROR "append to slice `y` with non-zero initialized length" +} + func MakezeroNolint() []int { x := make([]int, math.MaxInt8) return append(x, 1) //nolint:makezero // ok that we're appending to an uninitialized slice diff --git a/test/testdata/tagliatelle.go b/test/testdata/tagliatelle.go index 7ecb9f4a48a7..42823516b1b2 100644 --- a/test/testdata/tagliatelle.go +++ b/test/testdata/tagliatelle.go @@ -1,4 +1,4 @@ -//args: -Etagliatelle +// args: -Etagliatelle package testdata import "time" @@ -28,6 +28,6 @@ type Bur struct { Name string Value string `yaml:"Value"` // ERROR `yaml\(camel\): got 'Value' want 'value'` More string `json:"-"` - Also string `json:",omitempty"` + Also string `json:"also,omitempty"` ReqPerS string `avro:"req_per_s"` } diff --git a/test/testshared/testshared.go b/test/testshared/testshared.go index 0d1f91c01dd6..fa70c23131ae 100644 --- a/test/testshared/testshared.go +++ b/test/testshared/testshared.go @@ -76,6 +76,11 @@ func (r *RunResult) ExpectOutputContains(s string) *RunResult { return r } +func (r *RunResult) ExpectOutputNotContains(s string) *RunResult { + assert.NotContains(r.t, r.output, s, "exit code is %d", r.exitCode) + return r +} + func (r *RunResult) ExpectOutputEq(s string) *RunResult { assert.Equal(r.t, s, r.output, "exit code is %d", r.exitCode) return r