aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-12-01 01:15:39 +0000
committerTaras Madan <tarasmadan@google.com>2024-12-05 09:05:33 +0000
commit7c3db81921ceea352412011ea6cd8961e7224fb0 (patch)
tree55979369fc4d3319619d0537bc0c1e83dfb7b98f
parent29f61fceff5d68b408b9086bff96ca036b503584 (diff)
mod: bump github.com/golangci/golangci-lint from 1.62.0 to 1.62.2
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.62.0 to 1.62.2. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.62.0...v1.62.2) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
-rw-r--r--go.mod16
-rw-r--r--go.sum32
-rw-r--r--vendor/github.com/Antonboom/testifylint/internal/checkers/encoded_compare.go2
-rw-r--r--vendor/github.com/Antonboom/testifylint/internal/checkers/formatter.go8
-rw-r--r--vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_basic_type.go6
-rw-r--r--vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_encoded.go24
-rw-r--r--vendor/github.com/Antonboom/testifylint/internal/config/config.go2
-rw-r--r--vendor/github.com/Crocmagnon/fatcontext/pkg/analyzer/analyzer.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/internal/go/cache/cache.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/result/processors/sort_results.go211
-rw-r--r--vendor/github.com/mgechev/revive/lint/linter.go10
-rw-r--r--vendor/github.com/mgechev/revive/lint/package.go2
-rw-r--r--vendor/github.com/mgechev/revive/rule/add_constant.go (renamed from vendor/github.com/mgechev/revive/rule/add-constant.go)8
-rw-r--r--vendor/github.com/mgechev/revive/rule/argument_limit.go (renamed from vendor/github.com/mgechev/revive/rule/argument-limit.go)11
-rw-r--r--vendor/github.com/mgechev/revive/rule/banned_characters.go (renamed from vendor/github.com/mgechev/revive/rule/banned-characters.go)9
-rw-r--r--vendor/github.com/mgechev/revive/rule/bare_return.go (renamed from vendor/github.com/mgechev/revive/rule/bare-return.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/blank_imports.go (renamed from vendor/github.com/mgechev/revive/rule/blank-imports.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/bool_literal_in_expr.go (renamed from vendor/github.com/mgechev/revive/rule/bool-literal-in-expr.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/call_to_gc.go (renamed from vendor/github.com/mgechev/revive/rule/call-to-gc.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/cognitive_complexity.go (renamed from vendor/github.com/mgechev/revive/rule/cognitive-complexity.go)11
-rw-r--r--vendor/github.com/mgechev/revive/rule/comment_spacings.go (renamed from vendor/github.com/mgechev/revive/rule/comment-spacings.go)11
-rw-r--r--vendor/github.com/mgechev/revive/rule/comments_density.go (renamed from vendor/github.com/mgechev/revive/rule/comments-density.go)15
-rw-r--r--vendor/github.com/mgechev/revive/rule/confusing_naming.go (renamed from vendor/github.com/mgechev/revive/rule/confusing-naming.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/confusing_results.go (renamed from vendor/github.com/mgechev/revive/rule/confusing-results.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/constant_logical_expr.go (renamed from vendor/github.com/mgechev/revive/rule/constant-logical-expr.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/context_as_argument.go (renamed from vendor/github.com/mgechev/revive/rule/context-as-argument.go)15
-rw-r--r--vendor/github.com/mgechev/revive/rule/context_keys_type.go (renamed from vendor/github.com/mgechev/revive/rule/context-keys-type.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/cyclomatic.go11
-rw-r--r--vendor/github.com/mgechev/revive/rule/deep_exit.go (renamed from vendor/github.com/mgechev/revive/rule/deep-exit.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/defer.go11
-rw-r--r--vendor/github.com/mgechev/revive/rule/dot_imports.go (renamed from vendor/github.com/mgechev/revive/rule/dot-imports.go)12
-rw-r--r--vendor/github.com/mgechev/revive/rule/duplicated_imports.go (renamed from vendor/github.com/mgechev/revive/rule/duplicated-imports.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/early_return.go (renamed from vendor/github.com/mgechev/revive/rule/early-return.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/empty_block.go (renamed from vendor/github.com/mgechev/revive/rule/empty-block.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/empty_lines.go (renamed from vendor/github.com/mgechev/revive/rule/empty-lines.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/enforce_map_style.go (renamed from vendor/github.com/mgechev/revive/rule/enforce-map-style.go)14
-rw-r--r--vendor/github.com/mgechev/revive/rule/enforce_repeated_arg_type_style.go (renamed from vendor/github.com/mgechev/revive/rule/enforce-repeated-arg-type-style.go)13
-rw-r--r--vendor/github.com/mgechev/revive/rule/enforce_slice_style.go (renamed from vendor/github.com/mgechev/revive/rule/enforce-slice-style.go)14
-rw-r--r--vendor/github.com/mgechev/revive/rule/error_naming.go (renamed from vendor/github.com/mgechev/revive/rule/error-naming.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/error_return.go (renamed from vendor/github.com/mgechev/revive/rule/error-return.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/error_strings.go (renamed from vendor/github.com/mgechev/revive/rule/error-strings.go)12
-rw-r--r--vendor/github.com/mgechev/revive/rule/exported.go13
-rw-r--r--vendor/github.com/mgechev/revive/rule/file_header.go (renamed from vendor/github.com/mgechev/revive/rule/file-header.go)11
-rw-r--r--vendor/github.com/mgechev/revive/rule/file_length_limit.go (renamed from vendor/github.com/mgechev/revive/rule/file-length-limit.go)12
-rw-r--r--vendor/github.com/mgechev/revive/rule/filename_format.go (renamed from vendor/github.com/mgechev/revive/rule/filename-format.go)12
-rw-r--r--vendor/github.com/mgechev/revive/rule/flag_param.go (renamed from vendor/github.com/mgechev/revive/rule/flag-param.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/function_length.go (renamed from vendor/github.com/mgechev/revive/rule/function-length.go)17
-rw-r--r--vendor/github.com/mgechev/revive/rule/function_result_limit.go (renamed from vendor/github.com/mgechev/revive/rule/function-result-limit.go)11
-rw-r--r--vendor/github.com/mgechev/revive/rule/get_return.go (renamed from vendor/github.com/mgechev/revive/rule/get-return.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/identical_branches.go (renamed from vendor/github.com/mgechev/revive/rule/identical-branches.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/if_return.go (renamed from vendor/github.com/mgechev/revive/rule/if-return.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/import_alias_naming.go (renamed from vendor/github.com/mgechev/revive/rule/import-alias-naming.go)12
-rw-r--r--vendor/github.com/mgechev/revive/rule/import_shadowing.go (renamed from vendor/github.com/mgechev/revive/rule/import-shadowing.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/imports_blocklist.go (renamed from vendor/github.com/mgechev/revive/rule/imports-blocklist.go)31
-rw-r--r--vendor/github.com/mgechev/revive/rule/increment_decrement.go (renamed from vendor/github.com/mgechev/revive/rule/increment-decrement.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/indent_error_flow.go (renamed from vendor/github.com/mgechev/revive/rule/indent-error-flow.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/line_length_limit.go (renamed from vendor/github.com/mgechev/revive/rule/line-length-limit.go)11
-rw-r--r--vendor/github.com/mgechev/revive/rule/max_control_nesting.go (renamed from vendor/github.com/mgechev/revive/rule/max-control-nesting.go)11
-rw-r--r--vendor/github.com/mgechev/revive/rule/max_public_structs.go (renamed from vendor/github.com/mgechev/revive/rule/max-public-structs.go)18
-rw-r--r--vendor/github.com/mgechev/revive/rule/modifies_param.go (renamed from vendor/github.com/mgechev/revive/rule/modifies-param.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/modifies_value_receiver.go (renamed from vendor/github.com/mgechev/revive/rule/modifies-value-receiver.go)58
-rw-r--r--vendor/github.com/mgechev/revive/rule/nested_structs.go (renamed from vendor/github.com/mgechev/revive/rule/nested-structs.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/optimize_operands_order.go (renamed from vendor/github.com/mgechev/revive/rule/optimize-operands-order.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/package_comments.go (renamed from vendor/github.com/mgechev/revive/rule/package-comments.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/range_val_address.go (renamed from vendor/github.com/mgechev/revive/rule/range-val-address.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/range_val_in_closure.go (renamed from vendor/github.com/mgechev/revive/rule/range-val-in-closure.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/receiver_naming.go (renamed from vendor/github.com/mgechev/revive/rule/receiver-naming.go)11
-rw-r--r--vendor/github.com/mgechev/revive/rule/redefines_builtin_id.go (renamed from vendor/github.com/mgechev/revive/rule/redefines-builtin-id.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/redundant_import_alias.go (renamed from vendor/github.com/mgechev/revive/rule/redundant-import-alias.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/string_format.go (renamed from vendor/github.com/mgechev/revive/rule/string-format.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/string_of_int.go (renamed from vendor/github.com/mgechev/revive/rule/string-of-int.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/struct_tag.go (renamed from vendor/github.com/mgechev/revive/rule/struct-tag.go)11
-rw-r--r--vendor/github.com/mgechev/revive/rule/superfluous_else.go (renamed from vendor/github.com/mgechev/revive/rule/superfluous-else.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/time_equal.go (renamed from vendor/github.com/mgechev/revive/rule/time-equal.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/time_naming.go (renamed from vendor/github.com/mgechev/revive/rule/time-naming.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/unchecked_type_assertion.go (renamed from vendor/github.com/mgechev/revive/rule/unchecked-type-assertion.go)21
-rw-r--r--vendor/github.com/mgechev/revive/rule/unconditional_recursion.go (renamed from vendor/github.com/mgechev/revive/rule/unconditional-recursion.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/unexported_naming.go (renamed from vendor/github.com/mgechev/revive/rule/unexported-naming.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/unexported_return.go (renamed from vendor/github.com/mgechev/revive/rule/unexported-return.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/unhandled_error.go (renamed from vendor/github.com/mgechev/revive/rule/unhandled-error.go)12
-rw-r--r--vendor/github.com/mgechev/revive/rule/unnecessary_stmt.go (renamed from vendor/github.com/mgechev/revive/rule/unnecessary-stmt.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/unreachable_code.go (renamed from vendor/github.com/mgechev/revive/rule/unreachable-code.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/unused_param.go (renamed from vendor/github.com/mgechev/revive/rule/unused-param.go)14
-rw-r--r--vendor/github.com/mgechev/revive/rule/unused_receiver.go (renamed from vendor/github.com/mgechev/revive/rule/unused-receiver.go)14
-rw-r--r--vendor/github.com/mgechev/revive/rule/use_any.go (renamed from vendor/github.com/mgechev/revive/rule/use-any.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/useless_break.go (renamed from vendor/github.com/mgechev/revive/rule/useless-break.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/var_declarations.go (renamed from vendor/github.com/mgechev/revive/rule/var-declarations.go)0
-rw-r--r--vendor/github.com/mgechev/revive/rule/var_naming.go (renamed from vendor/github.com/mgechev/revive/rule/var-naming.go)13
-rw-r--r--vendor/github.com/mgechev/revive/rule/waitgroup_by_value.go (renamed from vendor/github.com/mgechev/revive/rule/waitgroup-by-value.go)0
-rw-r--r--vendor/github.com/nunnatsa/ginkgolinter/README.md6
-rw-r--r--vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actual.go4
-rw-r--r--vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actualarg.go27
-rw-r--r--vendor/github.com/nunnatsa/ginkgolinter/internal/expression/expression.go6
-rw-r--r--vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/dothandler.go8
-rw-r--r--vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/handler.go2
-rw-r--r--vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/namedhandler.go7
-rw-r--r--vendor/github.com/nunnatsa/ginkgolinter/internal/rules/errorequalnilrule.go11
-rw-r--r--vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go2
-rw-r--r--vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go2
-rw-r--r--vendor/github.com/uudashr/iface/opaque/opaque.go7
-rw-r--r--vendor/modules.txt18
101 files changed, 369 insertions, 534 deletions
diff --git a/go.mod b/go.mod
index 3752dca81..35fbcd201 100644
--- a/go.mod
+++ b/go.mod
@@ -14,7 +14,7 @@ require (
cloud.google.com/go/storage v1.43.0
github.com/VividCortex/gohistogram v1.0.0
github.com/dvyukov/go-fuzz v0.0.0-20220726122315-1d375ef9f9f6
- github.com/golangci/golangci-lint v1.62.0
+ github.com/golangci/golangci-lint v1.62.2
github.com/google/flatbuffers v24.3.25+incompatible
github.com/google/generative-ai-go v0.18.0
github.com/google/go-cmp v0.6.0
@@ -54,9 +54,9 @@ require (
github.com/Abirdcfly/dupword v0.1.3 // indirect
github.com/Antonboom/errname v1.0.0 // indirect
github.com/Antonboom/nilnil v1.0.0 // indirect
- github.com/Antonboom/testifylint v1.5.0 // indirect
+ github.com/Antonboom/testifylint v1.5.2 // indirect
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
- github.com/Crocmagnon/fatcontext v0.5.2 // indirect
+ github.com/Crocmagnon/fatcontext v0.5.3 // indirect
github.com/Djarvur/go-err113 v0.1.0 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect
github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.0 // indirect
@@ -166,7 +166,7 @@ require (
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
- github.com/mgechev/revive v1.5.0 // indirect
+ github.com/mgechev/revive v1.5.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moricho/tparallel v0.3.2 // indirect
@@ -174,13 +174,13 @@ require (
github.com/nakabonne/nestif v0.3.1 // indirect
github.com/nishanths/exhaustive v0.12.0 // indirect
github.com/nishanths/predeclared v0.2.2 // indirect
- github.com/nunnatsa/ginkgolinter v0.18.0 // indirect
+ github.com/nunnatsa/ginkgolinter v0.18.3 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
- github.com/polyfloyd/go-errorlint v1.6.0 // indirect
+ github.com/polyfloyd/go-errorlint v1.7.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
@@ -225,7 +225,7 @@ require (
github.com/ultraware/funlen v0.1.0 // indirect
github.com/ultraware/whitespace v0.1.1 // indirect
github.com/uudashr/gocognit v1.1.3 // indirect
- github.com/uudashr/iface v1.2.0 // indirect
+ github.com/uudashr/iface v1.2.1 // indirect
github.com/xen0n/gosmopolitan v1.2.2 // indirect
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.3.0 // indirect
@@ -245,7 +245,7 @@ require (
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
- golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0 // indirect
+ golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/term v0.26.0 // indirect
diff --git a/go.sum b/go.sum
index 745206c16..030872509 100644
--- a/go.sum
+++ b/go.sum
@@ -644,14 +644,14 @@ github.com/Antonboom/errname v1.0.0 h1:oJOOWR07vS1kRusl6YRSlat7HFnb3mSfMl6sDMRoT
github.com/Antonboom/errname v1.0.0/go.mod h1:gMOBFzK/vrTiXN9Oh+HFs+e6Ndl0eTFbtsRTSRdXyGI=
github.com/Antonboom/nilnil v1.0.0 h1:n+v+B12dsE5tbAqRODXmEKfZv9j2KcTBrp+LkoM4HZk=
github.com/Antonboom/nilnil v1.0.0/go.mod h1:fDJ1FSFoLN6yoG65ANb1WihItf6qt9PJVTn/s2IrcII=
-github.com/Antonboom/testifylint v1.5.0 h1:dlUIsDMtCrZWUnvkaCz3quJCoIjaGi41GzjPBGkkJ8A=
-github.com/Antonboom/testifylint v1.5.0/go.mod h1:wqaJbu0Blb5Wag2wv7Z5xt+CIV+eVLxtGZrlK13z3AE=
+github.com/Antonboom/testifylint v1.5.2 h1:4s3Xhuv5AvdIgbd8wOOEeo0uZG7PbDKQyKY5lGoQazk=
+github.com/Antonboom/testifylint v1.5.2/go.mod h1:vxy8VJ0bc6NavlYqjZfmp6EfqXMtBgQ4+mhCojwC1P8=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
-github.com/Crocmagnon/fatcontext v0.5.2 h1:vhSEg8Gqng8awhPju2w7MKHqMlg4/NI+gSDHtR3xgwA=
-github.com/Crocmagnon/fatcontext v0.5.2/go.mod h1:87XhRMaInHP44Q7Tlc7jkgKKB7kZAOPiDkFMdKCC+74=
+github.com/Crocmagnon/fatcontext v0.5.3 h1:zCh/wjc9oyeF+Gmp+V60wetm8ph2tlsxocgg/J0hOps=
+github.com/Crocmagnon/fatcontext v0.5.3/go.mod h1:XoCQYY1J+XTfyv74qLXvNw4xFunr3L1wkopIIKG7wGM=
github.com/Djarvur/go-err113 v0.1.0 h1:uCRZZOdMQ0TZPHYTdYpoC0bLYJKPEHPUJ8MeAa51lNU=
github.com/Djarvur/go-err113 v0.1.0/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU=
@@ -915,8 +915,8 @@ github.com/golangci/go-printf-func-name v0.1.0 h1:dVokQP+NMTO7jwO4bwsRwLWeudOVUP
github.com/golangci/go-printf-func-name v0.1.0/go.mod h1:wqhWFH5mUdJQhweRnldEywnR5021wTdZSNgwYceV14s=
github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 h1:/1322Qns6BtQxUZDTAT4SdcoxknUki7IAoK4SAXr8ME=
github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9/go.mod h1:Oesb/0uFAyWoaw1U1qS5zyjCg5NP9C9iwjnI4tIsXEE=
-github.com/golangci/golangci-lint v1.62.0 h1:/G0g+bi1BhmGJqLdNQkKBWjcim8HjOPc4tsKuHDOhcI=
-github.com/golangci/golangci-lint v1.62.0/go.mod h1:jtoOhQcKTz8B6dGNFyfQV3WZkQk+YvBDewDtNpiAJts=
+github.com/golangci/golangci-lint v1.62.2 h1:b8K5K9PN+rZN1+mKLtsZHz2XXS9aYKzQ9i25x3Qnxxw=
+github.com/golangci/golangci-lint v1.62.2/go.mod h1:ILWWyeFUrctpHVGMa1dg2xZPKoMUTc5OIMgW7HZr34g=
github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs=
github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo=
github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA=
@@ -1136,8 +1136,8 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
-github.com/mgechev/revive v1.5.0 h1:oaSmjA7rP8+HyoRuCgC531VHwnLH1AlJdjj+1AnQceQ=
-github.com/mgechev/revive v1.5.0/go.mod h1:L6T3H8EoerRO86c7WuGpvohIUmiploGiyoYbtIWFmV8=
+github.com/mgechev/revive v1.5.1 h1:hE+QPeq0/wIzJwOphdVyUJ82njdd8Khp4fUIHGZHW3M=
+github.com/mgechev/revive v1.5.1/go.mod h1:lC9AhkJIBs5zwx8wkudyHrU+IJkrEKmpCmGMnIJPk4o=
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY=
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
@@ -1154,8 +1154,8 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK
github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs=
github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk=
github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c=
-github.com/nunnatsa/ginkgolinter v0.18.0 h1:ZXO1wKhPg3A6LpbN5dMuqwhfOjN5c3ous8YdKOuqk9k=
-github.com/nunnatsa/ginkgolinter v0.18.0/go.mod h1:vPrWafSULmjMGCMsfGA908if95VnHQNAahvSBOjTuWs=
+github.com/nunnatsa/ginkgolinter v0.18.3 h1:WgS7X3zzmni3vwHSBhvSgqrRgUecN6PQUcfB0j1noDw=
+github.com/nunnatsa/ginkgolinter v0.18.3/go.mod h1:BE1xyB/PNtXXG1azrvrqJW5eFH0hSRylNzFy8QHPwzs=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4=
@@ -1187,8 +1187,8 @@ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgm
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
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 v1.6.0 h1:tftWV9DE7txiFzPpztTAwyoRLKNj9gpVm2cg8/OwcYY=
-github.com/polyfloyd/go-errorlint v1.6.0/go.mod h1:HR7u8wuP1kb1NeN1zqTd1ZMlqUKPPHF+Id4vIPvDqVw=
+github.com/polyfloyd/go-errorlint v1.7.0 h1:Zp6lzCK4hpBDj8y8a237YK4EPrMXQWvOe3nGoH4pFrU=
+github.com/polyfloyd/go-errorlint v1.7.0/go.mod h1:dGWKu85mGHnegQ2SWpEybFityCg3j7ZbwsVUxAOk9gY=
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
@@ -1326,8 +1326,8 @@ github.com/ultraware/whitespace v0.1.1 h1:bTPOGejYFulW3PkcrqkeQwOd6NKOOXvmGD9bo/
github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8=
github.com/uudashr/gocognit v1.1.3 h1:l+a111VcDbKfynh+airAy/DJQKaXh2m9vkoysMPSZyM=
github.com/uudashr/gocognit v1.1.3/go.mod h1:aKH8/e8xbTRBwjbCkwZ8qt4l2EpKXl31KMHgSS+lZ2U=
-github.com/uudashr/iface v1.2.0 h1:ECJjh5q/1Zmnv/2yFpWV6H3oMg5+Mo+vL0aqw9Gjazo=
-github.com/uudashr/iface v1.2.0/go.mod h1:Ux/7d/rAF3owK4m53cTVXL4YoVHKNqnoOeQHn2xrlp0=
+github.com/uudashr/iface v1.2.1 h1:vHHyzAUmWZ64Olq6NZT3vg/z1Ws56kyPdBOd5kTXDF8=
+github.com/uudashr/iface v1.2.1/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg=
github.com/vektra/mockery/v2 v2.45.1 h1:6HpdnKiLCjVtzlRLQPUNIM0u7yrvAoZ7VWF1TltJvTM=
github.com/vektra/mockery/v2 v2.45.1/go.mod h1:XNTE9RIu3deGAGQRVjP1VZxGpQNm0YedZx4oDs3prr8=
github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU=
@@ -1424,8 +1424,8 @@ golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWB
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY=
golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
-golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0 h1:bVwtbF629Xlyxk6xLQq2TDYmqP0uiWaet5LwRebuY0k=
-golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
+golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f h1:WTyX8eCCyfdqiPYkRGm0MqElSfYFH3yR1+rl/mct9sA=
+golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
diff --git a/vendor/github.com/Antonboom/testifylint/internal/checkers/encoded_compare.go b/vendor/github.com/Antonboom/testifylint/internal/checkers/encoded_compare.go
index 53c74ac45..1464fd640 100644
--- a/vendor/github.com/Antonboom/testifylint/internal/checkers/encoded_compare.go
+++ b/vendor/github.com/Antonboom/testifylint/internal/checkers/encoded_compare.go
@@ -48,7 +48,7 @@ func (checker EncodedCompare) Check(pass *analysis.Pass, call *CallMeta) *analys
switch {
case aIsExplicitJSON, bIsExplicitJSON, isJSONStyleExpr(pass, a), isJSONStyleExpr(pass, b):
proposed = "JSONEq"
- case isYAMLStyleExpr(a), isYAMLStyleExpr(b):
+ case isYAMLStyleExpr(pass, a), isYAMLStyleExpr(pass, b):
proposed = "YAMLEq"
}
diff --git a/vendor/github.com/Antonboom/testifylint/internal/checkers/formatter.go b/vendor/github.com/Antonboom/testifylint/internal/checkers/formatter.go
index 896b6bf5f..7ff4de470 100644
--- a/vendor/github.com/Antonboom/testifylint/internal/checkers/formatter.go
+++ b/vendor/github.com/Antonboom/testifylint/internal/checkers/formatter.go
@@ -115,7 +115,11 @@ func (checker Formatter) checkFmtAssertion(pass *analysis.Pass, call *CallMeta)
func isPrintfLikeCall(pass *analysis.Pass, call *CallMeta) (int, bool) {
msgAndArgsPos := getMsgAndArgsPosition(call.Fn.Signature)
- if msgAndArgsPos < 0 {
+ if msgAndArgsPos <= 0 {
+ return -1, false
+ }
+
+ if !(len(call.ArgsRaw) > msgAndArgsPos && hasStringType(pass, call.ArgsRaw[msgAndArgsPos])) {
return -1, false
}
@@ -123,7 +127,7 @@ func isPrintfLikeCall(pass *analysis.Pass, call *CallMeta) (int, bool) {
return -1, false
}
- return msgAndArgsPos, len(call.ArgsRaw) > msgAndArgsPos
+ return msgAndArgsPos, true
}
func assertHasFormattedAnalogue(pass *analysis.Pass, call *CallMeta) bool {
diff --git a/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_basic_type.go b/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_basic_type.go
index 9b43e914c..b4bb56321 100644
--- a/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_basic_type.go
+++ b/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_basic_type.go
@@ -166,6 +166,12 @@ func hasBytesType(pass *analysis.Pass, e ast.Expr) bool {
return ok && el.Kind() == types.Uint8
}
+// hasStringType returns true if the expression is of `string` type.
+func hasStringType(pass *analysis.Pass, e ast.Expr) bool {
+ basicType, ok := pass.TypesInfo.TypeOf(e).(*types.Basic)
+ return ok && basicType.Kind() == types.String
+}
+
// untype returns v from type(v) expression or v itself if there is no type conversion.
func untype(e ast.Expr) ast.Expr {
ce, ok := e.(*ast.CallExpr)
diff --git a/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_encoded.go b/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_encoded.go
index 35a497a72..c366f8563 100644
--- a/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_encoded.go
+++ b/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_encoded.go
@@ -11,13 +11,15 @@ import (
)
var (
+ wordsRe = regexp.MustCompile(`[A-Z]+(?:[a-z]*|$)|[a-z]+`) // NOTE(a.telyshev): ChatGPT.
+
jsonIdentRe = regexp.MustCompile(`json|JSON|Json`)
- yamlIdentRe = regexp.MustCompile(`yaml|YAML|Yaml|yml|YML|Yml`)
+ yamlWordRe = regexp.MustCompile(`yaml|YAML|Yaml|^(yml|YML|Yml)$`)
)
func isJSONStyleExpr(pass *analysis.Pass, e ast.Expr) bool {
if isIdentNamedAfterPattern(jsonIdentRe, e) {
- return true
+ return hasBytesType(pass, e) || hasStringType(pass, e)
}
if t, ok := pass.TypesInfo.Types[e]; ok && t.Value != nil {
@@ -35,6 +37,20 @@ func isJSONStyleExpr(pass *analysis.Pass, e ast.Expr) bool {
return false
}
-func isYAMLStyleExpr(e ast.Expr) bool {
- return isIdentNamedAfterPattern(yamlIdentRe, e)
+func isYAMLStyleExpr(pass *analysis.Pass, e ast.Expr) bool {
+ id, ok := e.(*ast.Ident)
+ return ok && (hasBytesType(pass, e) || hasStringType(pass, e)) && hasWordAfterPattern(id.Name, yamlWordRe)
+}
+
+func hasWordAfterPattern(s string, re *regexp.Regexp) bool {
+ for _, w := range splitIntoWords(s) {
+ if re.MatchString(w) {
+ return true
+ }
+ }
+ return false
+}
+
+func splitIntoWords(s string) []string {
+ return wordsRe.FindAllString(s, -1)
}
diff --git a/vendor/github.com/Antonboom/testifylint/internal/config/config.go b/vendor/github.com/Antonboom/testifylint/internal/config/config.go
index a8812e6d0..23b673428 100644
--- a/vendor/github.com/Antonboom/testifylint/internal/config/config.go
+++ b/vendor/github.com/Antonboom/testifylint/internal/config/config.go
@@ -133,7 +133,7 @@ func BindToFlags(cfg *Config, fs *flag.FlagSet) {
"to enable go vet's printf checks")
fs.BoolVar(&cfg.Formatter.RequireFFuncs,
"formatter.require-f-funcs", false,
- "to require f-assertions if format string is used")
+ "to require f-assertions (e.g. assert.Equalf) if format string is used, even if there are no variable-length variables.")
fs.BoolVar(&cfg.GoRequire.IgnoreHTTPHandlers,
"go-require.ignore-http-handlers", false,
diff --git a/vendor/github.com/Crocmagnon/fatcontext/pkg/analyzer/analyzer.go b/vendor/github.com/Crocmagnon/fatcontext/pkg/analyzer/analyzer.go
index a65efbba8..7b88bf56e 100644
--- a/vendor/github.com/Crocmagnon/fatcontext/pkg/analyzer/analyzer.go
+++ b/vendor/github.com/Crocmagnon/fatcontext/pkg/analyzer/analyzer.go
@@ -59,7 +59,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
{
Pos: assignStmt.Pos(),
End: assignStmt.End(),
- NewText: []byte(suggested),
+ NewText: suggested,
},
},
})
@@ -215,10 +215,10 @@ func getRootIdent(pass *analysis.Pass, node ast.Node) *ast.Ident {
}
// render returns the pretty-print of the given node
-func render(fset *token.FileSet, x interface{}) (string, error) {
+func render(fset *token.FileSet, x interface{}) ([]byte, error) {
var buf bytes.Buffer
if err := printer.Fprint(&buf, fset, x); err != nil {
- return "", fmt.Errorf("printing node: %w", err)
+ return nil, fmt.Errorf("printing node: %w", err)
}
- return buf.String(), nil
+ return buf.Bytes(), nil
}
diff --git a/vendor/github.com/golangci/golangci-lint/internal/go/cache/cache.go b/vendor/github.com/golangci/golangci-lint/internal/go/cache/cache.go
index 7bf4f1d66..85899ebc9 100644
--- a/vendor/github.com/golangci/golangci-lint/internal/go/cache/cache.go
+++ b/vendor/github.com/golangci/golangci-lint/internal/go/cache/cache.go
@@ -293,7 +293,7 @@ func GetBytes(c Cache, id ActionID) ([]byte, Entry, error) {
}
data, err := robustio.ReadFile(c.OutputFile(entry.OutputID))
if err != nil {
- return nil, entry, err
+ return nil, entry, &entryNotFoundError{Err: err}
}
if sha256.Sum256(data) != entry.OutputID {
return nil, entry, &entryNotFoundError{Err: errors.New("bad checksum")}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/result/processors/sort_results.go b/vendor/github.com/golangci/golangci-lint/pkg/result/processors/sort_results.go
index 4da73c72e..7eebea631 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/result/processors/sort_results.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/result/processors/sort_results.go
@@ -1,10 +1,9 @@
package processors
import (
- "errors"
+ "cmp"
"fmt"
"slices"
- "sort"
"strings"
"github.com/golangci/golangci-lint/pkg/config"
@@ -22,24 +21,32 @@ const (
orderNameSeverity = "severity"
)
+const (
+ less = iota - 1
+ equal
+ greater
+)
+
var _ Processor = (*SortResults)(nil)
+type issueComparator func(a, b *result.Issue) int
+
type SortResults struct {
- cmps map[string]*comparator
+ cmps map[string][]issueComparator
cfg *config.Output
}
func NewSortResults(cfg *config.Config) *SortResults {
return &SortResults{
- cmps: map[string]*comparator{
+ cmps: map[string][]issueComparator{
// For sorting we are comparing (in next order):
// file names, line numbers, position, and finally - giving up.
- orderNameFile: byFileName().SetNext(byLine().SetNext(byColumn())),
+ orderNameFile: {byFileName, byLine, byColumn},
// For sorting we are comparing: linter name
- orderNameLinter: byLinter(),
+ orderNameLinter: {byLinter},
// For sorting we are comparing: severity
- orderNameSeverity: bySeverity(),
+ orderNameSeverity: {bySeverity},
},
cfg: &cfg.Output,
}
@@ -57,23 +64,21 @@ func (p SortResults) Process(issues []result.Issue) ([]result.Issue, error) {
p.cfg.SortOrder = []string{orderNameFile}
}
- var cmps []*comparator
+ var cmps []issueComparator
+
for _, name := range p.cfg.SortOrder {
c, ok := p.cmps[name]
if !ok {
return nil, fmt.Errorf("unsupported sort-order name %q", name)
}
- cmps = append(cmps, c)
+ cmps = append(cmps, c...)
}
- cmp, err := mergeComparators(cmps)
- if err != nil {
- return nil, err
- }
+ comp := mergeComparators(cmps...)
- sort.Slice(issues, func(i, j int) bool {
- return cmp.Compare(&issues[i], &issues[j]) == less
+ slices.SortFunc(issues, func(a, b result.Issue) int {
+ return comp(&a, &b)
})
return issues, nil
@@ -81,147 +86,32 @@ func (p SortResults) Process(issues []result.Issue) ([]result.Issue, error) {
func (SortResults) Finish() {}
-type compareResult int
-
-const (
- less compareResult = iota - 1
- equal
- greater
- none
-)
-
-func (c compareResult) isNeutral() bool {
- // return true if compare result is incomparable or equal.
- return c == none || c == equal
-}
-
-func (c compareResult) String() string {
- switch c {
- case less:
- return "less"
- case equal:
- return "equal"
- case greater:
- return "greater"
- default:
- return "none"
- }
-}
-
-// comparator describes how to implement compare for two "issues".
-type comparator struct {
- name string
- compare func(a, b *result.Issue) compareResult
- next *comparator
-}
-
-func (cmp *comparator) Next() *comparator { return cmp.next }
-
-func (cmp *comparator) SetNext(c *comparator) *comparator {
- cmp.next = c
- return cmp
+func byFileName(a, b *result.Issue) int {
+ return strings.Compare(a.FilePath(), b.FilePath())
}
-func (cmp *comparator) String() string {
- s := cmp.name
- if cmp.Next() != nil {
- s += " > " + cmp.Next().String()
- }
-
- return s
+func byLine(a, b *result.Issue) int {
+ return numericCompare(a.Line(), b.Line())
}
-func (cmp *comparator) Compare(a, b *result.Issue) compareResult {
- res := cmp.compare(a, b)
- if !res.isNeutral() {
- return res
- }
-
- if next := cmp.Next(); next != nil {
- return next.Compare(a, b)
- }
-
- return res
+func byColumn(a, b *result.Issue) int {
+ return numericCompare(a.Column(), b.Column())
}
-func byFileName() *comparator {
- return &comparator{
- name: "byFileName",
- compare: func(a, b *result.Issue) compareResult {
- return compareResult(strings.Compare(a.FilePath(), b.FilePath()))
- },
- }
+func byLinter(a, b *result.Issue) int {
+ return strings.Compare(a.FromLinter, b.FromLinter)
}
-func byLine() *comparator {
- return &comparator{
- name: "byLine",
- compare: func(a, b *result.Issue) compareResult {
- return numericCompare(a.Line(), b.Line())
- },
- }
+func bySeverity(a, b *result.Issue) int {
+ return severityCompare(a.Severity, b.Severity)
}
-func byColumn() *comparator {
- return &comparator{
- name: "byColumn",
- compare: func(a, b *result.Issue) compareResult {
- return numericCompare(a.Column(), b.Column())
- },
- }
-}
-
-func byLinter() *comparator {
- return &comparator{
- name: "byLinter",
- compare: func(a, b *result.Issue) compareResult {
- return compareResult(strings.Compare(a.FromLinter, b.FromLinter))
- },
- }
-}
-
-func bySeverity() *comparator {
- return &comparator{
- name: "bySeverity",
- compare: func(a, b *result.Issue) compareResult {
- return severityCompare(a.Severity, b.Severity)
- },
- }
-}
-
-func mergeComparators(cmps []*comparator) (*comparator, error) {
- if len(cmps) == 0 {
- return nil, errors.New("no comparator")
- }
-
- for i := range len(cmps) - 1 {
- findComparatorTip(cmps[i]).SetNext(cmps[i+1])
- }
-
- return cmps[0], nil
-}
-
-func findComparatorTip(cmp *comparator) *comparator {
- if cmp.Next() != nil {
- return findComparatorTip(cmp.Next())
- }
-
- return cmp
-}
-
-func severityCompare(a, b string) compareResult {
+func severityCompare(a, b string) int {
// The position inside the slice define the importance (lower to higher).
classic := []string{"low", "medium", "high", "warning", "error"}
if slices.Contains(classic, a) && slices.Contains(classic, b) {
- switch {
- case slices.Index(classic, a) > slices.Index(classic, b):
- return greater
- case slices.Index(classic, a) < slices.Index(classic, b):
- return less
- default:
- return equal
- }
+ return cmp.Compare(slices.Index(classic, a), slices.Index(classic, b))
}
if slices.Contains(classic, a) {
@@ -232,28 +122,27 @@ func severityCompare(a, b string) compareResult {
return less
}
- return compareResult(strings.Compare(a, b))
+ return strings.Compare(a, b)
}
-func numericCompare(a, b int) compareResult {
- var (
- isValuesInvalid = a < 0 || b < 0
- isZeroValuesBoth = a == 0 && b == 0
- isEqual = a == b
- isZeroValueInA = b > 0 && a == 0
- isZeroValueInB = a > 0 && b == 0
- )
-
- switch {
- case isZeroValuesBoth || isEqual:
+func numericCompare(a, b int) int {
+ // Negative values and zeros are skipped (equal) because they either invalid or "neutral" (default int value).
+ if a <= 0 || b <= 0 {
return equal
- case isValuesInvalid || isZeroValueInA || isZeroValueInB:
- return none
- case a > b:
- return greater
- case a < b:
- return less
}
- return equal
+ return cmp.Compare(a, b)
+}
+
+func mergeComparators(comps ...issueComparator) issueComparator {
+ return func(a, b *result.Issue) int {
+ for _, comp := range comps {
+ i := comp(a, b)
+ if i != equal {
+ return i
+ }
+ }
+
+ return equal
+ }
}
diff --git a/vendor/github.com/mgechev/revive/lint/linter.go b/vendor/github.com/mgechev/revive/lint/linter.go
index 56036e83d..b777f9251 100644
--- a/vendor/github.com/mgechev/revive/lint/linter.go
+++ b/vendor/github.com/mgechev/revive/lint/linter.go
@@ -109,7 +109,7 @@ func (l *Linter) Lint(packages [][]string, ruleSet []Rule, config Config) (<-cha
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
- defer wg.Done()
+ wg.Done()
}(packages[n], perPkgVersions[n])
}
@@ -173,6 +173,10 @@ func detectGoMod(dir string) (rootDir string, ver *goversion.Version, err error)
return "", nil, fmt.Errorf("failed to parse %q, got %v", modFileName, err)
}
+ if modAst.Go == nil {
+ return "", nil, fmt.Errorf("%q does not specify a Go version", modFileName)
+ }
+
ver, err = goversion.NewVersion(modAst.Go.Version)
return filepath.Dir(modFileName), ver, err
}
@@ -180,7 +184,9 @@ func detectGoMod(dir string) (rootDir string, ver *goversion.Version, err error)
func retrieveModFile(dir string) (string, error) {
const lookingForFile = "go.mod"
for {
- if dir == "." || dir == "/" {
+ // filepath.Dir returns 'C:\' on Windows, and '/' on Unix
+ isRootDir := (dir == filepath.VolumeName(dir)+string(filepath.Separator))
+ if dir == "." || isRootDir {
return "", fmt.Errorf("did not found %q file", lookingForFile)
}
diff --git a/vendor/github.com/mgechev/revive/lint/package.go b/vendor/github.com/mgechev/revive/lint/package.go
index 2ab035f16..4a633f35a 100644
--- a/vendor/github.com/mgechev/revive/lint/package.go
+++ b/vendor/github.com/mgechev/revive/lint/package.go
@@ -189,7 +189,7 @@ func (p *Package) lint(rules []Rule, config Config, failures chan Failure) {
wg.Add(1)
go (func(file *File) {
file.lint(rules, config, failures)
- defer wg.Done()
+ wg.Done()
})(file)
}
wg.Wait()
diff --git a/vendor/github.com/mgechev/revive/rule/add-constant.go b/vendor/github.com/mgechev/revive/rule/add_constant.go
index 233f1d848..399382c8b 100644
--- a/vendor/github.com/mgechev/revive/rule/add-constant.go
+++ b/vendor/github.com/mgechev/revive/rule/add_constant.go
@@ -36,12 +36,13 @@ type AddConstantRule struct {
allowList allowList
ignoreFunctions []*regexp.Regexp
strLitLimit int
- sync.Mutex
+
+ configureOnce sync.Once
}
// Apply applies the rule to given file.
func (r *AddConstantRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
@@ -201,9 +202,6 @@ func (w *lintAddConstantRule) isStructTag(n *ast.BasicLit) bool {
}
func (r *AddConstantRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
if r.allowList == nil {
r.strLitLimit = defaultStrLitLimit
r.allowList = newAllowList()
diff --git a/vendor/github.com/mgechev/revive/rule/argument-limit.go b/vendor/github.com/mgechev/revive/rule/argument_limit.go
index b6ce0e81a..b4d56de0e 100644
--- a/vendor/github.com/mgechev/revive/rule/argument-limit.go
+++ b/vendor/github.com/mgechev/revive/rule/argument_limit.go
@@ -11,18 +11,13 @@ import (
// ArgumentsLimitRule lints given else constructs.
type ArgumentsLimitRule struct {
max int
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultArgumentsLimit = 8
func (r *ArgumentsLimitRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.max != 0 {
- return
- }
-
if len(arguments) < 1 {
r.max = defaultArgumentsLimit
return
@@ -37,7 +32,7 @@ func (r *ArgumentsLimitRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *ArgumentsLimitRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
onFailure := func(failure lint.Failure) {
diff --git a/vendor/github.com/mgechev/revive/rule/banned-characters.go b/vendor/github.com/mgechev/revive/rule/banned_characters.go
index 12997bae1..926b32c21 100644
--- a/vendor/github.com/mgechev/revive/rule/banned-characters.go
+++ b/vendor/github.com/mgechev/revive/rule/banned_characters.go
@@ -12,15 +12,14 @@ import (
// BannedCharsRule checks if a file contains banned characters.
type BannedCharsRule struct {
bannedCharList []string
- sync.Mutex
+
+ configureOnce sync.Once
}
const bannedCharsRuleName = "banned-characters"
func (r *BannedCharsRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.bannedCharList == nil && len(arguments) > 0 {
+ if len(arguments) > 0 {
checkNumberOfArguments(1, arguments, bannedCharsRuleName)
r.bannedCharList = r.getBannedCharsList(arguments)
}
@@ -28,7 +27,7 @@ func (r *BannedCharsRule) configure(arguments lint.Arguments) {
// Apply applied the rule to the given file.
func (r *BannedCharsRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
onFailure := func(failure lint.Failure) {
diff --git a/vendor/github.com/mgechev/revive/rule/bare-return.go b/vendor/github.com/mgechev/revive/rule/bare_return.go
index 147fa84db..147fa84db 100644
--- a/vendor/github.com/mgechev/revive/rule/bare-return.go
+++ b/vendor/github.com/mgechev/revive/rule/bare_return.go
diff --git a/vendor/github.com/mgechev/revive/rule/blank-imports.go b/vendor/github.com/mgechev/revive/rule/blank_imports.go
index 0ddb4aad2..0ddb4aad2 100644
--- a/vendor/github.com/mgechev/revive/rule/blank-imports.go
+++ b/vendor/github.com/mgechev/revive/rule/blank_imports.go
diff --git a/vendor/github.com/mgechev/revive/rule/bool-literal-in-expr.go b/vendor/github.com/mgechev/revive/rule/bool_literal_in_expr.go
index 71551e55a..71551e55a 100644
--- a/vendor/github.com/mgechev/revive/rule/bool-literal-in-expr.go
+++ b/vendor/github.com/mgechev/revive/rule/bool_literal_in_expr.go
diff --git a/vendor/github.com/mgechev/revive/rule/call-to-gc.go b/vendor/github.com/mgechev/revive/rule/call_to_gc.go
index 9c68380a4..9c68380a4 100644
--- a/vendor/github.com/mgechev/revive/rule/call-to-gc.go
+++ b/vendor/github.com/mgechev/revive/rule/call_to_gc.go
diff --git a/vendor/github.com/mgechev/revive/rule/cognitive-complexity.go b/vendor/github.com/mgechev/revive/rule/cognitive_complexity.go
index 83640fd3d..ecde3882e 100644
--- a/vendor/github.com/mgechev/revive/rule/cognitive-complexity.go
+++ b/vendor/github.com/mgechev/revive/rule/cognitive_complexity.go
@@ -13,18 +13,13 @@ import (
// CognitiveComplexityRule lints given else constructs.
type CognitiveComplexityRule struct {
maxComplexity int
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultMaxCognitiveComplexity = 7
func (r *CognitiveComplexityRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.maxComplexity != 0 {
- return // already configured
- }
-
if len(arguments) < 1 {
r.maxComplexity = defaultMaxCognitiveComplexity
return
@@ -40,7 +35,7 @@ func (r *CognitiveComplexityRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *CognitiveComplexityRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/comment-spacings.go b/vendor/github.com/mgechev/revive/rule/comment_spacings.go
index f72151301..7bdc0e71d 100644
--- a/vendor/github.com/mgechev/revive/rule/comment-spacings.go
+++ b/vendor/github.com/mgechev/revive/rule/comment_spacings.go
@@ -12,16 +12,11 @@ import (
// the comment symbol( // ) and the start of the comment text
type CommentSpacingsRule struct {
allowList []string
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *CommentSpacingsRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.allowList != nil {
- return // already configured
- }
-
r.allowList = []string{}
for _, arg := range arguments {
allow, ok := arg.(string) // Alt. non panicking version
@@ -34,7 +29,7 @@ func (r *CommentSpacingsRule) configure(arguments lint.Arguments) {
// Apply the rule.
func (r *CommentSpacingsRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
- r.configure(args)
+ r.configureOnce.Do(func() { r.configure(args) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/comments-density.go b/vendor/github.com/mgechev/revive/rule/comments_density.go
index c5298ea07..f2382b1f0 100644
--- a/vendor/github.com/mgechev/revive/rule/comments-density.go
+++ b/vendor/github.com/mgechev/revive/rule/comments_density.go
@@ -12,22 +12,13 @@ import (
// CommentsDensityRule lints given else constructs.
type CommentsDensityRule struct {
minimumCommentsDensity int64
- configured bool
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultMinimumCommentsPercentage = 0
func (r *CommentsDensityRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.configured {
- return
- }
-
- r.configured = true
-
if len(arguments) < 1 {
r.minimumCommentsDensity = defaultMinimumCommentsPercentage
return
@@ -42,7 +33,7 @@ func (r *CommentsDensityRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *CommentsDensityRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
commentsLines := countDocLines(file.AST.Comments)
statementsCount := countStatements(file.AST)
diff --git a/vendor/github.com/mgechev/revive/rule/confusing-naming.go b/vendor/github.com/mgechev/revive/rule/confusing_naming.go
index 32f6dd803..32f6dd803 100644
--- a/vendor/github.com/mgechev/revive/rule/confusing-naming.go
+++ b/vendor/github.com/mgechev/revive/rule/confusing_naming.go
diff --git a/vendor/github.com/mgechev/revive/rule/confusing-results.go b/vendor/github.com/mgechev/revive/rule/confusing_results.go
index 1b79ada9c..1b79ada9c 100644
--- a/vendor/github.com/mgechev/revive/rule/confusing-results.go
+++ b/vendor/github.com/mgechev/revive/rule/confusing_results.go
diff --git a/vendor/github.com/mgechev/revive/rule/constant-logical-expr.go b/vendor/github.com/mgechev/revive/rule/constant_logical_expr.go
index 9e34d3d16..9e34d3d16 100644
--- a/vendor/github.com/mgechev/revive/rule/constant-logical-expr.go
+++ b/vendor/github.com/mgechev/revive/rule/constant_logical_expr.go
diff --git a/vendor/github.com/mgechev/revive/rule/context-as-argument.go b/vendor/github.com/mgechev/revive/rule/context_as_argument.go
index e0c8cfa5e..8bc5f8b61 100644
--- a/vendor/github.com/mgechev/revive/rule/context-as-argument.go
+++ b/vendor/github.com/mgechev/revive/rule/context_as_argument.go
@@ -12,32 +12,31 @@ import (
// ContextAsArgumentRule lints given else constructs.
type ContextAsArgumentRule struct {
allowTypesLUT map[string]struct{}
- sync.Mutex
+
+ configureOnce sync.Once
}
// Apply applies the rule to given file.
func (r *ContextAsArgumentRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
- r.Lock()
- if r.allowTypesLUT == nil {
- r.allowTypesLUT = getAllowTypesFromArguments(args)
- }
- r.Unlock()
+ r.configureOnce.Do(func() { r.configure(args) })
var failures []lint.Failure
- r.Lock()
walker := lintContextArguments{
allowTypesLUT: r.allowTypesLUT,
onFailure: func(failure lint.Failure) {
failures = append(failures, failure)
},
}
- r.Unlock()
ast.Walk(walker, file.AST)
return failures
}
+func (r *ContextAsArgumentRule) configure(arguments lint.Arguments) {
+ r.allowTypesLUT = getAllowTypesFromArguments(arguments)
+}
+
// Name returns the rule name.
func (*ContextAsArgumentRule) Name() string {
return "context-as-argument"
diff --git a/vendor/github.com/mgechev/revive/rule/context-keys-type.go b/vendor/github.com/mgechev/revive/rule/context_keys_type.go
index 60ccec560..60ccec560 100644
--- a/vendor/github.com/mgechev/revive/rule/context-keys-type.go
+++ b/vendor/github.com/mgechev/revive/rule/context_keys_type.go
diff --git a/vendor/github.com/mgechev/revive/rule/cyclomatic.go b/vendor/github.com/mgechev/revive/rule/cyclomatic.go
index 10413de24..c1a2de97a 100644
--- a/vendor/github.com/mgechev/revive/rule/cyclomatic.go
+++ b/vendor/github.com/mgechev/revive/rule/cyclomatic.go
@@ -14,18 +14,13 @@ import (
// CyclomaticRule lints given else constructs.
type CyclomaticRule struct {
maxComplexity int
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultMaxCyclomaticComplexity = 10
func (r *CyclomaticRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.maxComplexity != 0 {
- return // already configured
- }
-
if len(arguments) < 1 {
r.maxComplexity = defaultMaxCyclomaticComplexity
return
@@ -40,7 +35,7 @@ func (r *CyclomaticRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *CyclomaticRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
fileAst := file.AST
diff --git a/vendor/github.com/mgechev/revive/rule/deep-exit.go b/vendor/github.com/mgechev/revive/rule/deep_exit.go
index 7b3dd0f82..7b3dd0f82 100644
--- a/vendor/github.com/mgechev/revive/rule/deep-exit.go
+++ b/vendor/github.com/mgechev/revive/rule/deep_exit.go
diff --git a/vendor/github.com/mgechev/revive/rule/defer.go b/vendor/github.com/mgechev/revive/rule/defer.go
index 3c31d507b..f7c716eb6 100644
--- a/vendor/github.com/mgechev/revive/rule/defer.go
+++ b/vendor/github.com/mgechev/revive/rule/defer.go
@@ -11,22 +11,17 @@ import (
// DeferRule lints unused params in functions.
type DeferRule struct {
allow map[string]bool
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *DeferRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.allow != nil {
- return // already configured
- }
-
r.allow = r.allowFromArgs(arguments)
}
// Apply applies the rule to given file.
func (r *DeferRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
onFailure := func(failure lint.Failure) {
diff --git a/vendor/github.com/mgechev/revive/rule/dot-imports.go b/vendor/github.com/mgechev/revive/rule/dot_imports.go
index df0b2a7f4..f6c7fbcfb 100644
--- a/vendor/github.com/mgechev/revive/rule/dot-imports.go
+++ b/vendor/github.com/mgechev/revive/rule/dot_imports.go
@@ -10,13 +10,14 @@ import (
// DotImportsRule lints given else constructs.
type DotImportsRule struct {
- sync.Mutex
allowedPackages allowPackages
+
+ configureOnce sync.Once
}
// Apply applies the rule to given file.
func (r *DotImportsRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
@@ -41,13 +42,6 @@ func (*DotImportsRule) Name() string {
}
func (r *DotImportsRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.allowedPackages != nil {
- return
- }
-
r.allowedPackages = make(allowPackages)
if len(arguments) == 0 {
return
diff --git a/vendor/github.com/mgechev/revive/rule/duplicated-imports.go b/vendor/github.com/mgechev/revive/rule/duplicated_imports.go
index 2b177fac6..2b177fac6 100644
--- a/vendor/github.com/mgechev/revive/rule/duplicated-imports.go
+++ b/vendor/github.com/mgechev/revive/rule/duplicated_imports.go
diff --git a/vendor/github.com/mgechev/revive/rule/early-return.go b/vendor/github.com/mgechev/revive/rule/early_return.go
index 62d491f27..62d491f27 100644
--- a/vendor/github.com/mgechev/revive/rule/early-return.go
+++ b/vendor/github.com/mgechev/revive/rule/early_return.go
diff --git a/vendor/github.com/mgechev/revive/rule/empty-block.go b/vendor/github.com/mgechev/revive/rule/empty_block.go
index 25a052a0e..25a052a0e 100644
--- a/vendor/github.com/mgechev/revive/rule/empty-block.go
+++ b/vendor/github.com/mgechev/revive/rule/empty_block.go
diff --git a/vendor/github.com/mgechev/revive/rule/empty-lines.go b/vendor/github.com/mgechev/revive/rule/empty_lines.go
index 2710a8979..2710a8979 100644
--- a/vendor/github.com/mgechev/revive/rule/empty-lines.go
+++ b/vendor/github.com/mgechev/revive/rule/empty_lines.go
diff --git a/vendor/github.com/mgechev/revive/rule/enforce-map-style.go b/vendor/github.com/mgechev/revive/rule/enforce_map_style.go
index c698c40ed..7ddf31e35 100644
--- a/vendor/github.com/mgechev/revive/rule/enforce-map-style.go
+++ b/vendor/github.com/mgechev/revive/rule/enforce_map_style.go
@@ -39,20 +39,12 @@ func mapStyleFromString(s string) (enforceMapStyleType, error) {
// EnforceMapStyleRule implements a rule to enforce `make(map[type]type)` over `map[type]type{}`.
type EnforceMapStyleRule struct {
- configured bool
enforceMapStyle enforceMapStyleType
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *EnforceMapStyleRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.configured {
- return
- }
- r.configured = true
-
if len(arguments) < 1 {
r.enforceMapStyle = enforceMapStyleTypeAny
return
@@ -72,7 +64,7 @@ func (r *EnforceMapStyleRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *EnforceMapStyleRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
if r.enforceMapStyle == enforceMapStyleTypeAny {
// this linter is not configured
diff --git a/vendor/github.com/mgechev/revive/rule/enforce-repeated-arg-type-style.go b/vendor/github.com/mgechev/revive/rule/enforce_repeated_arg_type_style.go
index a435ee186..3f9712aef 100644
--- a/vendor/github.com/mgechev/revive/rule/enforce-repeated-arg-type-style.go
+++ b/vendor/github.com/mgechev/revive/rule/enforce_repeated_arg_type_style.go
@@ -41,22 +41,13 @@ func repeatedArgTypeStyleFromString(s string) enforceRepeatedArgTypeStyleType {
// EnforceRepeatedArgTypeStyleRule implements a rule to enforce repeated argument type style.
type EnforceRepeatedArgTypeStyleRule struct {
- configured bool
funcArgStyle enforceRepeatedArgTypeStyleType
funcRetValStyle enforceRepeatedArgTypeStyleType
- sync.Mutex
+ configureOnce sync.Once
}
func (r *EnforceRepeatedArgTypeStyleRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.configured {
- return
- }
- r.configured = true
-
r.funcArgStyle = enforceRepeatedArgTypeStyleTypeAny
r.funcRetValStyle = enforceRepeatedArgTypeStyleTypeAny
@@ -94,7 +85,7 @@ func (r *EnforceRepeatedArgTypeStyleRule) configure(arguments lint.Arguments) {
// Apply applies the rule to a given file.
func (r *EnforceRepeatedArgTypeStyleRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
if r.funcArgStyle == enforceRepeatedArgTypeStyleTypeAny && r.funcRetValStyle == enforceRepeatedArgTypeStyleTypeAny {
// This linter is not configured, return no failures.
diff --git a/vendor/github.com/mgechev/revive/rule/enforce-slice-style.go b/vendor/github.com/mgechev/revive/rule/enforce_slice_style.go
index 14be25893..7170379d9 100644
--- a/vendor/github.com/mgechev/revive/rule/enforce-slice-style.go
+++ b/vendor/github.com/mgechev/revive/rule/enforce_slice_style.go
@@ -43,20 +43,12 @@ func sliceStyleFromString(s string) (enforceSliceStyleType, error) {
// EnforceSliceStyleRule implements a rule to enforce `make([]type)` over `[]type{}`.
type EnforceSliceStyleRule struct {
- configured bool
enforceSliceStyle enforceSliceStyleType
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *EnforceSliceStyleRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.configured {
- return
- }
- r.configured = true
-
if len(arguments) < 1 {
r.enforceSliceStyle = enforceSliceStyleTypeAny
return
@@ -76,7 +68,7 @@ func (r *EnforceSliceStyleRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *EnforceSliceStyleRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
if r.enforceSliceStyle == enforceSliceStyleTypeAny {
// this linter is not configured
diff --git a/vendor/github.com/mgechev/revive/rule/error-naming.go b/vendor/github.com/mgechev/revive/rule/error_naming.go
index a4f24f3f0..a4f24f3f0 100644
--- a/vendor/github.com/mgechev/revive/rule/error-naming.go
+++ b/vendor/github.com/mgechev/revive/rule/error_naming.go
diff --git a/vendor/github.com/mgechev/revive/rule/error-return.go b/vendor/github.com/mgechev/revive/rule/error_return.go
index a724e001c..a724e001c 100644
--- a/vendor/github.com/mgechev/revive/rule/error-return.go
+++ b/vendor/github.com/mgechev/revive/rule/error_return.go
diff --git a/vendor/github.com/mgechev/revive/rule/error-strings.go b/vendor/github.com/mgechev/revive/rule/error_strings.go
index 81ebda540..97a0f4d06 100644
--- a/vendor/github.com/mgechev/revive/rule/error-strings.go
+++ b/vendor/github.com/mgechev/revive/rule/error_strings.go
@@ -15,17 +15,11 @@ import (
// ErrorStringsRule lints given else constructs.
type ErrorStringsRule struct {
errorFunctions map[string]map[string]struct{}
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *ErrorStringsRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.errorFunctions != nil {
- return
- }
-
r.errorFunctions = map[string]map[string]struct{}{
"fmt": {
"Errorf": {},
@@ -60,7 +54,7 @@ func (r *ErrorStringsRule) configure(arguments lint.Arguments) {
func (r *ErrorStringsRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
var failures []lint.Failure
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
fileAst := file.AST
walker := lintErrorStrings{
diff --git a/vendor/github.com/mgechev/revive/rule/exported.go b/vendor/github.com/mgechev/revive/rule/exported.go
index e3972d40e..7ee27b309 100644
--- a/vendor/github.com/mgechev/revive/rule/exported.go
+++ b/vendor/github.com/mgechev/revive/rule/exported.go
@@ -55,20 +55,13 @@ func (dc *disabledChecks) isDisabled(checkName string) bool {
// ExportedRule lints given else constructs.
type ExportedRule struct {
- configured bool
stuttersMsg string
disabledChecks disabledChecks
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *ExportedRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.configured {
- return
- }
- r.configured = true
-
r.disabledChecks = disabledChecks{PrivateReceivers: true, PublicInterfaces: true}
r.stuttersMsg = "stutters"
for _, flag := range arguments {
@@ -104,7 +97,7 @@ func (r *ExportedRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *ExportedRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
- r.configure(args)
+ r.configureOnce.Do(func() { r.configure(args) })
var failures []lint.Failure
if file.IsTest() {
diff --git a/vendor/github.com/mgechev/revive/rule/file-header.go b/vendor/github.com/mgechev/revive/rule/file_header.go
index 0dcb57746..52513d8e8 100644
--- a/vendor/github.com/mgechev/revive/rule/file-header.go
+++ b/vendor/github.com/mgechev/revive/rule/file_header.go
@@ -11,7 +11,8 @@ import (
// FileHeaderRule lints given else constructs.
type FileHeaderRule struct {
header string
- sync.Mutex
+
+ configureOnce sync.Once
}
var (
@@ -20,12 +21,6 @@ var (
)
func (r *FileHeaderRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.header != "" {
- return // already configured
- }
-
if len(arguments) < 1 {
return
}
@@ -39,7 +34,7 @@ func (r *FileHeaderRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *FileHeaderRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
if r.header == "" {
return nil
diff --git a/vendor/github.com/mgechev/revive/rule/file-length-limit.go b/vendor/github.com/mgechev/revive/rule/file_length_limit.go
index c5a5641f4..0fe075c56 100644
--- a/vendor/github.com/mgechev/revive/rule/file-length-limit.go
+++ b/vendor/github.com/mgechev/revive/rule/file_length_limit.go
@@ -20,12 +20,13 @@ type FileLengthLimitRule struct {
skipComments bool
// skipBlankLines indicates whether to skip blank lines when counting lines.
skipBlankLines bool
- sync.Mutex
+
+ configureOnce sync.Once
}
// Apply applies the rule to given file.
func (r *FileLengthLimitRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
if r.max <= 0 {
// when max is negative or 0 the rule is disabled
@@ -75,13 +76,6 @@ func (r *FileLengthLimitRule) Apply(file *lint.File, arguments lint.Arguments) [
}
func (r *FileLengthLimitRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.max != 0 {
- return // already configured
- }
-
if len(arguments) < 1 {
return // use default
}
diff --git a/vendor/github.com/mgechev/revive/rule/filename-format.go b/vendor/github.com/mgechev/revive/rule/filename_format.go
index 49fdf9c3e..9d8047829 100644
--- a/vendor/github.com/mgechev/revive/rule/filename-format.go
+++ b/vendor/github.com/mgechev/revive/rule/filename_format.go
@@ -13,12 +13,13 @@ import (
// FilenameFormatRule lints source filenames according to a set of regular expressions given as arguments
type FilenameFormatRule struct {
format *regexp.Regexp
- sync.Mutex
+
+ configureOnce sync.Once
}
// Apply applies the rule to the given file.
func (r *FilenameFormatRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
filename := filepath.Base(file.Name)
if r.format.MatchString(filename) {
@@ -55,13 +56,6 @@ func (*FilenameFormatRule) Name() string {
var defaultFormat = regexp.MustCompile("^[_A-Za-z0-9][_A-Za-z0-9-]*.go$")
func (r *FilenameFormatRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.format != nil {
- return
- }
-
argsCount := len(arguments)
if argsCount == 0 {
r.format = defaultFormat
diff --git a/vendor/github.com/mgechev/revive/rule/flag-param.go b/vendor/github.com/mgechev/revive/rule/flag_param.go
index f9bfb712c..f9bfb712c 100644
--- a/vendor/github.com/mgechev/revive/rule/flag-param.go
+++ b/vendor/github.com/mgechev/revive/rule/flag_param.go
diff --git a/vendor/github.com/mgechev/revive/rule/function-length.go b/vendor/github.com/mgechev/revive/rule/function_length.go
index 30402313d..c58cd4c0f 100644
--- a/vendor/github.com/mgechev/revive/rule/function-length.go
+++ b/vendor/github.com/mgechev/revive/rule/function_length.go
@@ -11,20 +11,13 @@ import (
// FunctionLength lint.
type FunctionLength struct {
- maxStmt int
- maxLines int
- configured bool
- sync.Mutex
+ maxStmt int
+ maxLines int
+
+ configureOnce sync.Once
}
func (r *FunctionLength) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.configured {
- return
- }
-
- r.configured = true
maxStmt, maxLines := r.parseArguments(arguments)
r.maxStmt = int(maxStmt)
r.maxLines = int(maxLines)
@@ -32,7 +25,7 @@ func (r *FunctionLength) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *FunctionLength) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/function-result-limit.go b/vendor/github.com/mgechev/revive/rule/function_result_limit.go
index 23474b5ee..5b72f01ab 100644
--- a/vendor/github.com/mgechev/revive/rule/function-result-limit.go
+++ b/vendor/github.com/mgechev/revive/rule/function_result_limit.go
@@ -11,18 +11,13 @@ import (
// FunctionResultsLimitRule lints given else constructs.
type FunctionResultsLimitRule struct {
max int
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultResultsLimit = 3
func (r *FunctionResultsLimitRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.max != 0 {
- return // already configured
- }
-
if len(arguments) < 1 {
r.max = defaultResultsLimit
return
@@ -41,7 +36,7 @@ func (r *FunctionResultsLimitRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *FunctionResultsLimitRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/get-return.go b/vendor/github.com/mgechev/revive/rule/get_return.go
index 06323a087..06323a087 100644
--- a/vendor/github.com/mgechev/revive/rule/get-return.go
+++ b/vendor/github.com/mgechev/revive/rule/get_return.go
diff --git a/vendor/github.com/mgechev/revive/rule/identical-branches.go b/vendor/github.com/mgechev/revive/rule/identical_branches.go
index c6008925f..c6008925f 100644
--- a/vendor/github.com/mgechev/revive/rule/identical-branches.go
+++ b/vendor/github.com/mgechev/revive/rule/identical_branches.go
diff --git a/vendor/github.com/mgechev/revive/rule/if-return.go b/vendor/github.com/mgechev/revive/rule/if_return.go
index a6a3113ad..a6a3113ad 100644
--- a/vendor/github.com/mgechev/revive/rule/if-return.go
+++ b/vendor/github.com/mgechev/revive/rule/if_return.go
diff --git a/vendor/github.com/mgechev/revive/rule/import-alias-naming.go b/vendor/github.com/mgechev/revive/rule/import_alias_naming.go
index 48d22566a..043bf0d76 100644
--- a/vendor/github.com/mgechev/revive/rule/import-alias-naming.go
+++ b/vendor/github.com/mgechev/revive/rule/import_alias_naming.go
@@ -10,10 +10,10 @@ import (
// ImportAliasNamingRule lints import alias naming.
type ImportAliasNamingRule struct {
- configured bool
allowRegexp *regexp.Regexp
denyRegexp *regexp.Regexp
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultImportAliasNamingAllowRule = "^[a-z][a-z0-9]{0,}$"
@@ -21,12 +21,6 @@ const defaultImportAliasNamingAllowRule = "^[a-z][a-z0-9]{0,}$"
var defaultImportAliasNamingAllowRegexp = regexp.MustCompile(defaultImportAliasNamingAllowRule)
func (r *ImportAliasNamingRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.configured {
- return
- }
-
if len(arguments) == 0 {
r.allowRegexp = defaultImportAliasNamingAllowRegexp
return
@@ -57,7 +51,7 @@ func (r *ImportAliasNamingRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *ImportAliasNamingRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/import-shadowing.go b/vendor/github.com/mgechev/revive/rule/import_shadowing.go
index 046aeb688..046aeb688 100644
--- a/vendor/github.com/mgechev/revive/rule/import-shadowing.go
+++ b/vendor/github.com/mgechev/revive/rule/import_shadowing.go
diff --git a/vendor/github.com/mgechev/revive/rule/imports-blocklist.go b/vendor/github.com/mgechev/revive/rule/imports_blocklist.go
index 431066403..18d77ca1c 100644
--- a/vendor/github.com/mgechev/revive/rule/imports-blocklist.go
+++ b/vendor/github.com/mgechev/revive/rule/imports_blocklist.go
@@ -11,29 +11,24 @@ import (
// ImportsBlocklistRule lints given else constructs.
type ImportsBlocklistRule struct {
blocklist []*regexp.Regexp
- sync.Mutex
+
+ configureOnce sync.Once
}
var replaceImportRegexp = regexp.MustCompile(`/?\*\*/?`)
func (r *ImportsBlocklistRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.blocklist == nil {
- r.blocklist = make([]*regexp.Regexp, 0)
-
- for _, arg := range arguments {
- argStr, ok := arg.(string)
- if !ok {
- panic(fmt.Sprintf("Invalid argument to the imports-blocklist rule. Expecting a string, got %T", arg))
- }
- regStr, err := regexp.Compile(fmt.Sprintf(`(?m)"%s"$`, replaceImportRegexp.ReplaceAllString(argStr, `(\W|\w)*`)))
- if err != nil {
- panic(fmt.Sprintf("Invalid argument to the imports-blocklist rule. Expecting %q to be a valid regular expression, got: %v", argStr, err))
- }
- r.blocklist = append(r.blocklist, regStr)
+ r.blocklist = []*regexp.Regexp{}
+ for _, arg := range arguments {
+ argStr, ok := arg.(string)
+ if !ok {
+ panic(fmt.Sprintf("Invalid argument to the imports-blocklist rule. Expecting a string, got %T", arg))
+ }
+ regStr, err := regexp.Compile(fmt.Sprintf(`(?m)"%s"$`, replaceImportRegexp.ReplaceAllString(argStr, `(\W|\w)*`)))
+ if err != nil {
+ panic(fmt.Sprintf("Invalid argument to the imports-blocklist rule. Expecting %q to be a valid regular expression, got: %v", argStr, err))
}
+ r.blocklist = append(r.blocklist, regStr)
}
}
@@ -48,7 +43,7 @@ func (r *ImportsBlocklistRule) isBlocklisted(path string) bool {
// Apply applies the rule to given file.
func (r *ImportsBlocklistRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/increment-decrement.go b/vendor/github.com/mgechev/revive/rule/increment_decrement.go
index 34a8e1ec5..34a8e1ec5 100644
--- a/vendor/github.com/mgechev/revive/rule/increment-decrement.go
+++ b/vendor/github.com/mgechev/revive/rule/increment_decrement.go
diff --git a/vendor/github.com/mgechev/revive/rule/indent-error-flow.go b/vendor/github.com/mgechev/revive/rule/indent_error_flow.go
index ebc1e793a..ebc1e793a 100644
--- a/vendor/github.com/mgechev/revive/rule/indent-error-flow.go
+++ b/vendor/github.com/mgechev/revive/rule/indent_error_flow.go
diff --git a/vendor/github.com/mgechev/revive/rule/line-length-limit.go b/vendor/github.com/mgechev/revive/rule/line_length_limit.go
index a154b7aec..415761e1e 100644
--- a/vendor/github.com/mgechev/revive/rule/line-length-limit.go
+++ b/vendor/github.com/mgechev/revive/rule/line_length_limit.go
@@ -15,18 +15,13 @@ import (
// LineLengthLimitRule lints given else constructs.
type LineLengthLimitRule struct {
max int
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultLineLengthLimit = 80
func (r *LineLengthLimitRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.max != 0 {
- return // already configured
- }
-
if len(arguments) < 1 {
r.max = defaultLineLengthLimit
return
@@ -42,7 +37,7 @@ func (r *LineLengthLimitRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *LineLengthLimitRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/max-control-nesting.go b/vendor/github.com/mgechev/revive/rule/max_control_nesting.go
index 5dbb1eefa..b2c5af70e 100644
--- a/vendor/github.com/mgechev/revive/rule/max-control-nesting.go
+++ b/vendor/github.com/mgechev/revive/rule/max_control_nesting.go
@@ -11,14 +11,15 @@ import (
// MaxControlNestingRule lints given else constructs.
type MaxControlNestingRule struct {
max int64
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultMaxControlNesting = 5
// Apply applies the rule to given file.
func (r *MaxControlNestingRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
@@ -107,12 +108,6 @@ func (w *lintMaxControlNesting) walkControlledBlock(b ast.Node) {
}
func (r *MaxControlNestingRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if !(r.max < 1) {
- return // max already configured
- }
-
if len(arguments) < 1 {
r.max = defaultMaxControlNesting
return
diff --git a/vendor/github.com/mgechev/revive/rule/max-public-structs.go b/vendor/github.com/mgechev/revive/rule/max_public_structs.go
index 70840e734..d6f91e375 100644
--- a/vendor/github.com/mgechev/revive/rule/max-public-structs.go
+++ b/vendor/github.com/mgechev/revive/rule/max_public_structs.go
@@ -1,6 +1,7 @@
package rule
import (
+ "fmt"
"go/ast"
"strings"
"sync"
@@ -11,18 +12,13 @@ import (
// MaxPublicStructsRule lints given else constructs.
type MaxPublicStructsRule struct {
max int64
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultMaxPublicStructs = 5
func (r *MaxPublicStructsRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.max == 0 {
- return // already configured
- }
-
if len(arguments) < 1 {
r.max = defaultMaxPublicStructs
return
@@ -39,10 +35,14 @@ func (r *MaxPublicStructsRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *MaxPublicStructsRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
+ if r.max < 1 {
+ return failures
+ }
+
fileAst := file.AST
walker := &lintMaxPublicStructs{
@@ -56,7 +56,7 @@ func (r *MaxPublicStructsRule) Apply(file *lint.File, arguments lint.Arguments)
if walker.current > r.max {
walker.onFailure(lint.Failure{
- Failure: "you have exceeded the maximum number of public struct declarations",
+ Failure: fmt.Sprintf("you have exceeded the maximum number (%d) of public struct declarations", r.max),
Confidence: 1,
Node: fileAst,
Category: "style",
diff --git a/vendor/github.com/mgechev/revive/rule/modifies-param.go b/vendor/github.com/mgechev/revive/rule/modifies_param.go
index a68ae2501..a68ae2501 100644
--- a/vendor/github.com/mgechev/revive/rule/modifies-param.go
+++ b/vendor/github.com/mgechev/revive/rule/modifies_param.go
diff --git a/vendor/github.com/mgechev/revive/rule/modifies-value-receiver.go b/vendor/github.com/mgechev/revive/rule/modifies_value_receiver.go
index e9e64b9a6..2f92991f5 100644
--- a/vendor/github.com/mgechev/revive/rule/modifies-value-receiver.go
+++ b/vendor/github.com/mgechev/revive/rule/modifies_value_receiver.go
@@ -2,6 +2,7 @@ package rule
import (
"go/ast"
+ "go/token"
"strings"
"github.com/mgechev/revive/lint"
@@ -60,14 +61,14 @@ func (w lintModifiesValRecRule) Visit(node ast.Node) ast.Visitor {
return nil // skip, anonymous receiver
}
- fselect := func(n ast.Node) bool {
+ receiverAssignmentFinder := func(n ast.Node) bool {
// look for assignments with the receiver in the right hand
- asgmt, ok := n.(*ast.AssignStmt)
+ assignment, ok := n.(*ast.AssignStmt)
if !ok {
return false
}
- for _, exp := range asgmt.Lhs {
+ for _, exp := range assignment.Lhs {
switch e := exp.(type) {
case *ast.IndexExpr: // receiver...[] = ...
continue
@@ -92,7 +93,15 @@ func (w lintModifiesValRecRule) Visit(node ast.Node) ast.Visitor {
return false
}
- assignmentsToReceiver := pick(n.Body, fselect)
+ assignmentsToReceiver := pick(n.Body, receiverAssignmentFinder)
+ if len(assignmentsToReceiver) == 0 {
+ return nil // receiver is not modified
+ }
+
+ methodReturnsReceiver := len(w.findReturnReceiverStatements(receiverName, n.Body)) > 0
+ if methodReturnsReceiver {
+ return nil // modification seems legit (see issue #1066)
+ }
for _, assignment := range assignmentsToReceiver {
w.onFailure(lint.Failure{
@@ -127,3 +136,44 @@ func (lintModifiesValRecRule) getNameFromExpr(ie ast.Expr) string {
return ident.Name
}
+
+func (w lintModifiesValRecRule) findReturnReceiverStatements(receiverName string, target ast.Node) []ast.Node {
+ finder := func(n ast.Node) bool {
+ // look for returns with the receiver as value
+ returnStatement, ok := n.(*ast.ReturnStmt)
+ if !ok {
+ return false
+ }
+
+ for _, exp := range returnStatement.Results {
+ switch e := exp.(type) {
+ case *ast.SelectorExpr: // receiver.field = ...
+ name := w.getNameFromExpr(e.X)
+ if name == "" || name != receiverName {
+ continue
+ }
+ case *ast.Ident: // receiver := ...
+ if e.Name != receiverName {
+ continue
+ }
+ case *ast.UnaryExpr:
+ if e.Op != token.AND {
+ continue
+ }
+ name := w.getNameFromExpr(e.X)
+ if name == "" || name != receiverName {
+ continue
+ }
+
+ default:
+ continue
+ }
+
+ return true
+ }
+
+ return false
+ }
+
+ return pick(target, finder)
+}
diff --git a/vendor/github.com/mgechev/revive/rule/nested-structs.go b/vendor/github.com/mgechev/revive/rule/nested_structs.go
index 147bd482b..147bd482b 100644
--- a/vendor/github.com/mgechev/revive/rule/nested-structs.go
+++ b/vendor/github.com/mgechev/revive/rule/nested_structs.go
diff --git a/vendor/github.com/mgechev/revive/rule/optimize-operands-order.go b/vendor/github.com/mgechev/revive/rule/optimize_operands_order.go
index 43d982d6b..43d982d6b 100644
--- a/vendor/github.com/mgechev/revive/rule/optimize-operands-order.go
+++ b/vendor/github.com/mgechev/revive/rule/optimize_operands_order.go
diff --git a/vendor/github.com/mgechev/revive/rule/package-comments.go b/vendor/github.com/mgechev/revive/rule/package_comments.go
index f1e5462fe..f1e5462fe 100644
--- a/vendor/github.com/mgechev/revive/rule/package-comments.go
+++ b/vendor/github.com/mgechev/revive/rule/package_comments.go
diff --git a/vendor/github.com/mgechev/revive/rule/range-val-address.go b/vendor/github.com/mgechev/revive/rule/range_val_address.go
index d2ab0392a..d2ab0392a 100644
--- a/vendor/github.com/mgechev/revive/rule/range-val-address.go
+++ b/vendor/github.com/mgechev/revive/rule/range_val_address.go
diff --git a/vendor/github.com/mgechev/revive/rule/range-val-in-closure.go b/vendor/github.com/mgechev/revive/rule/range_val_in_closure.go
index 6f9255a74..6f9255a74 100644
--- a/vendor/github.com/mgechev/revive/rule/range-val-in-closure.go
+++ b/vendor/github.com/mgechev/revive/rule/range_val_in_closure.go
diff --git a/vendor/github.com/mgechev/revive/rule/receiver-naming.go b/vendor/github.com/mgechev/revive/rule/receiver_naming.go
index afcd99b8f..c83bacc2f 100644
--- a/vendor/github.com/mgechev/revive/rule/receiver-naming.go
+++ b/vendor/github.com/mgechev/revive/rule/receiver_naming.go
@@ -12,18 +12,13 @@ import (
// ReceiverNamingRule lints given else constructs.
type ReceiverNamingRule struct {
receiverNameMaxLength int
- sync.Mutex
+
+ configureOnce sync.Once
}
const defaultReceiverNameMaxLength = -1 // thus will not check
func (r *ReceiverNamingRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.receiverNameMaxLength != 0 {
- return
- }
-
r.receiverNameMaxLength = defaultReceiverNameMaxLength
if len(arguments) < 1 {
return
@@ -50,7 +45,7 @@ func (r *ReceiverNamingRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *ReceiverNamingRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
- r.configure(args)
+ r.configureOnce.Do(func() { r.configure(args) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/redefines-builtin-id.go b/vendor/github.com/mgechev/revive/rule/redefines_builtin_id.go
index 10ea16ae1..10ea16ae1 100644
--- a/vendor/github.com/mgechev/revive/rule/redefines-builtin-id.go
+++ b/vendor/github.com/mgechev/revive/rule/redefines_builtin_id.go
diff --git a/vendor/github.com/mgechev/revive/rule/redundant-import-alias.go b/vendor/github.com/mgechev/revive/rule/redundant_import_alias.go
index fa5281f24..fa5281f24 100644
--- a/vendor/github.com/mgechev/revive/rule/redundant-import-alias.go
+++ b/vendor/github.com/mgechev/revive/rule/redundant_import_alias.go
diff --git a/vendor/github.com/mgechev/revive/rule/string-format.go b/vendor/github.com/mgechev/revive/rule/string_format.go
index ecac3fa7c..ecac3fa7c 100644
--- a/vendor/github.com/mgechev/revive/rule/string-format.go
+++ b/vendor/github.com/mgechev/revive/rule/string_format.go
diff --git a/vendor/github.com/mgechev/revive/rule/string-of-int.go b/vendor/github.com/mgechev/revive/rule/string_of_int.go
index 3bec1d6ac..3bec1d6ac 100644
--- a/vendor/github.com/mgechev/revive/rule/string-of-int.go
+++ b/vendor/github.com/mgechev/revive/rule/string_of_int.go
diff --git a/vendor/github.com/mgechev/revive/rule/struct-tag.go b/vendor/github.com/mgechev/revive/rule/struct_tag.go
index ec3f0c7cf..4dd927827 100644
--- a/vendor/github.com/mgechev/revive/rule/struct-tag.go
+++ b/vendor/github.com/mgechev/revive/rule/struct_tag.go
@@ -14,15 +14,12 @@ import (
// StructTagRule lints struct tags.
type StructTagRule struct {
userDefined map[string][]string // map: key -> []option
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *StructTagRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- mustConfigure := r.userDefined == nil && len(arguments) > 0
- if !mustConfigure {
+ if len(arguments) == 0 {
return
}
@@ -47,7 +44,7 @@ func (r *StructTagRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *StructTagRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
- r.configure(args)
+ r.configureOnce.Do(func() { r.configure(args) })
var failures []lint.Failure
onFailure := func(failure lint.Failure) {
diff --git a/vendor/github.com/mgechev/revive/rule/superfluous-else.go b/vendor/github.com/mgechev/revive/rule/superfluous_else.go
index 18e8f3bdd..18e8f3bdd 100644
--- a/vendor/github.com/mgechev/revive/rule/superfluous-else.go
+++ b/vendor/github.com/mgechev/revive/rule/superfluous_else.go
diff --git a/vendor/github.com/mgechev/revive/rule/time-equal.go b/vendor/github.com/mgechev/revive/rule/time_equal.go
index a4fab88b3..a4fab88b3 100644
--- a/vendor/github.com/mgechev/revive/rule/time-equal.go
+++ b/vendor/github.com/mgechev/revive/rule/time_equal.go
diff --git a/vendor/github.com/mgechev/revive/rule/time-naming.go b/vendor/github.com/mgechev/revive/rule/time_naming.go
index 5bccf8a7a..5bccf8a7a 100644
--- a/vendor/github.com/mgechev/revive/rule/time-naming.go
+++ b/vendor/github.com/mgechev/revive/rule/time_naming.go
diff --git a/vendor/github.com/mgechev/revive/rule/unchecked-type-assertion.go b/vendor/github.com/mgechev/revive/rule/unchecked_type_assertion.go
index eea344060..34d854e8f 100644
--- a/vendor/github.com/mgechev/revive/rule/unchecked-type-assertion.go
+++ b/vendor/github.com/mgechev/revive/rule/unchecked_type_assertion.go
@@ -15,21 +15,16 @@ const (
// UncheckedTypeAssertionRule lints missing or ignored `ok`-value in dynamic type casts.
type UncheckedTypeAssertionRule struct {
- sync.Mutex
acceptIgnoredAssertionResult bool
- configured bool
-}
-func (u *UncheckedTypeAssertionRule) configure(arguments lint.Arguments) {
- u.Lock()
- defer u.Unlock()
+ configureOnce sync.Once
+}
- if len(arguments) == 0 || u.configured {
+func (r *UncheckedTypeAssertionRule) configure(arguments lint.Arguments) {
+ if len(arguments) == 0 {
return
}
- u.configured = true
-
args, ok := arguments[0].(map[string]any)
if !ok {
panic("Unable to get arguments. Expected object of key-value-pairs.")
@@ -38,7 +33,7 @@ func (u *UncheckedTypeAssertionRule) configure(arguments lint.Arguments) {
for k, v := range args {
switch k {
case "acceptIgnoredAssertionResult":
- u.acceptIgnoredAssertionResult, ok = v.(bool)
+ r.acceptIgnoredAssertionResult, ok = v.(bool)
if !ok {
panic(fmt.Sprintf("Unable to parse argument '%s'. Expected boolean.", k))
}
@@ -49,8 +44,8 @@ func (u *UncheckedTypeAssertionRule) configure(arguments lint.Arguments) {
}
// Apply applies the rule to given file.
-func (u *UncheckedTypeAssertionRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
- u.configure(args)
+func (r *UncheckedTypeAssertionRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
+ r.configureOnce.Do(func() { r.configure(args) })
var failures []lint.Failure
@@ -58,7 +53,7 @@ func (u *UncheckedTypeAssertionRule) Apply(file *lint.File, args lint.Arguments)
onFailure: func(failure lint.Failure) {
failures = append(failures, failure)
},
- acceptIgnoredTypeAssertionResult: u.acceptIgnoredAssertionResult,
+ acceptIgnoredTypeAssertionResult: r.acceptIgnoredAssertionResult,
}
ast.Walk(walker, file.AST)
diff --git a/vendor/github.com/mgechev/revive/rule/unconditional-recursion.go b/vendor/github.com/mgechev/revive/rule/unconditional_recursion.go
index d806b6757..d806b6757 100644
--- a/vendor/github.com/mgechev/revive/rule/unconditional-recursion.go
+++ b/vendor/github.com/mgechev/revive/rule/unconditional_recursion.go
diff --git a/vendor/github.com/mgechev/revive/rule/unexported-naming.go b/vendor/github.com/mgechev/revive/rule/unexported_naming.go
index 0c2b39d41..0c2b39d41 100644
--- a/vendor/github.com/mgechev/revive/rule/unexported-naming.go
+++ b/vendor/github.com/mgechev/revive/rule/unexported_naming.go
diff --git a/vendor/github.com/mgechev/revive/rule/unexported-return.go b/vendor/github.com/mgechev/revive/rule/unexported_return.go
index 10f8e3fbe..10f8e3fbe 100644
--- a/vendor/github.com/mgechev/revive/rule/unexported-return.go
+++ b/vendor/github.com/mgechev/revive/rule/unexported_return.go
diff --git a/vendor/github.com/mgechev/revive/rule/unhandled-error.go b/vendor/github.com/mgechev/revive/rule/unhandled_error.go
index 95ba56180..4fad8ccfc 100644
--- a/vendor/github.com/mgechev/revive/rule/unhandled-error.go
+++ b/vendor/github.com/mgechev/revive/rule/unhandled_error.go
@@ -14,17 +14,11 @@ import (
// UnhandledErrorRule lints given else constructs.
type UnhandledErrorRule struct {
ignoreList []*regexp.Regexp
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *UnhandledErrorRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.ignoreList != nil {
- return // already configured
- }
-
for _, arg := range arguments {
argStr, ok := arg.(string)
if !ok {
@@ -47,7 +41,7 @@ func (r *UnhandledErrorRule) configure(arguments lint.Arguments) {
// Apply applies the rule to given file.
func (r *UnhandledErrorRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
- r.configure(args)
+ r.configureOnce.Do(func() { r.configure(args) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/unnecessary-stmt.go b/vendor/github.com/mgechev/revive/rule/unnecessary_stmt.go
index 8e0784ba4..8e0784ba4 100644
--- a/vendor/github.com/mgechev/revive/rule/unnecessary-stmt.go
+++ b/vendor/github.com/mgechev/revive/rule/unnecessary_stmt.go
diff --git a/vendor/github.com/mgechev/revive/rule/unreachable-code.go b/vendor/github.com/mgechev/revive/rule/unreachable_code.go
index dcc5b7905..dcc5b7905 100644
--- a/vendor/github.com/mgechev/revive/rule/unreachable-code.go
+++ b/vendor/github.com/mgechev/revive/rule/unreachable_code.go
diff --git a/vendor/github.com/mgechev/revive/rule/unused-param.go b/vendor/github.com/mgechev/revive/rule/unused_param.go
index 4b04ee916..a8514ac2d 100644
--- a/vendor/github.com/mgechev/revive/rule/unused-param.go
+++ b/vendor/github.com/mgechev/revive/rule/unused_param.go
@@ -11,22 +11,14 @@ import (
// UnusedParamRule lints unused params in functions.
type UnusedParamRule struct {
- configured bool
// regex to check if some name is valid for unused parameter, "^_$" by default
allowRegex *regexp.Regexp
failureMsg string
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *UnusedParamRule) configure(args lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.configured {
- return
- }
- r.configured = true
-
// while by default args is an array, i think it's good to provide structures inside it by default, not arrays or primitives
// it's more compatible to JSON nature of configurations
var allowedRegexStr string
@@ -58,7 +50,7 @@ func (r *UnusedParamRule) configure(args lint.Arguments) {
// Apply applies the rule to given file.
func (r *UnusedParamRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
- r.configure(args)
+ r.configureOnce.Do(func() { r.configure(args) })
var failures []lint.Failure
onFailure := func(failure lint.Failure) {
diff --git a/vendor/github.com/mgechev/revive/rule/unused-receiver.go b/vendor/github.com/mgechev/revive/rule/unused_receiver.go
index 715dba338..131aae5fb 100644
--- a/vendor/github.com/mgechev/revive/rule/unused-receiver.go
+++ b/vendor/github.com/mgechev/revive/rule/unused_receiver.go
@@ -11,22 +11,14 @@ import (
// UnusedReceiverRule lints unused params in functions.
type UnusedReceiverRule struct {
- configured bool
// regex to check if some name is valid for unused parameter, "^_$" by default
allowRegex *regexp.Regexp
failureMsg string
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *UnusedReceiverRule) configure(args lint.Arguments) {
- r.Lock()
- defer r.Unlock()
-
- if r.configured {
- return
- }
- r.configured = true
-
// while by default args is an array, i think it's good to provide structures inside it by default, not arrays or primitives
// it's more compatible to JSON nature of configurations
var allowedRegexStr string
@@ -57,7 +49,7 @@ func (r *UnusedReceiverRule) configure(args lint.Arguments) {
// Apply applies the rule to given file.
func (r *UnusedReceiverRule) Apply(file *lint.File, args lint.Arguments) []lint.Failure {
- r.configure(args)
+ r.configureOnce.Do(func() { r.configure(args) })
var failures []lint.Failure
onFailure := func(failure lint.Failure) {
diff --git a/vendor/github.com/mgechev/revive/rule/use-any.go b/vendor/github.com/mgechev/revive/rule/use_any.go
index 88160c2fa..88160c2fa 100644
--- a/vendor/github.com/mgechev/revive/rule/use-any.go
+++ b/vendor/github.com/mgechev/revive/rule/use_any.go
diff --git a/vendor/github.com/mgechev/revive/rule/useless-break.go b/vendor/github.com/mgechev/revive/rule/useless_break.go
index 8db20c9b8..8db20c9b8 100644
--- a/vendor/github.com/mgechev/revive/rule/useless-break.go
+++ b/vendor/github.com/mgechev/revive/rule/useless_break.go
diff --git a/vendor/github.com/mgechev/revive/rule/var-declarations.go b/vendor/github.com/mgechev/revive/rule/var_declarations.go
index 3f9d7068a..3f9d7068a 100644
--- a/vendor/github.com/mgechev/revive/rule/var-declarations.go
+++ b/vendor/github.com/mgechev/revive/rule/var_declarations.go
diff --git a/vendor/github.com/mgechev/revive/rule/var-naming.go b/vendor/github.com/mgechev/revive/rule/var_naming.go
index 5a4d0dc24..2c2198dbd 100644
--- a/vendor/github.com/mgechev/revive/rule/var-naming.go
+++ b/vendor/github.com/mgechev/revive/rule/var_naming.go
@@ -18,22 +18,15 @@ var upperCaseConstRE = regexp.MustCompile(`^_?[A-Z][A-Z\d]*(_[A-Z\d]+)*$`)
// VarNamingRule lints given else constructs.
type VarNamingRule struct {
- configured bool
allowList []string
blockList []string
allowUpperCaseConst bool // if true - allows to use UPPER_SOME_NAMES for constants
skipPackageNameChecks bool
- sync.Mutex
+
+ configureOnce sync.Once
}
func (r *VarNamingRule) configure(arguments lint.Arguments) {
- r.Lock()
- defer r.Unlock()
- if r.configured {
- return
- }
-
- r.configured = true
if len(arguments) >= 1 {
r.allowList = getList(arguments[0], "allowlist")
}
@@ -83,7 +76,7 @@ func (r *VarNamingRule) applyPackageCheckRules(walker *lintNames) {
// Apply applies the rule to given file.
func (r *VarNamingRule) Apply(file *lint.File, arguments lint.Arguments) []lint.Failure {
- r.configure(arguments)
+ r.configureOnce.Do(func() { r.configure(arguments) })
var failures []lint.Failure
diff --git a/vendor/github.com/mgechev/revive/rule/waitgroup-by-value.go b/vendor/github.com/mgechev/revive/rule/waitgroup_by_value.go
index a2d304ae5..a2d304ae5 100644
--- a/vendor/github.com/mgechev/revive/rule/waitgroup-by-value.go
+++ b/vendor/github.com/mgechev/revive/rule/waitgroup_by_value.go
diff --git a/vendor/github.com/nunnatsa/ginkgolinter/README.md b/vendor/github.com/nunnatsa/ginkgolinter/README.md
index 536a65e7b..012628ed7 100644
--- a/vendor/github.com/nunnatsa/ginkgolinter/README.md
+++ b/vendor/github.com/nunnatsa/ginkgolinter/README.md
@@ -249,7 +249,7 @@ This will probably happen when using the old format:
Eventually(aFunc, 500 * time.Millisecond /*timeout*/, 10 * time.Second /*polling*/).Should(Succeed())
```
-### Correct usage of the `Succeed()` matcher [Bug]
+### Prevent Wrong Actual Values with the Succeed() matcher [Bug]
The `Succeed()` matcher only accepts a single error value. this rule validates that.
For example:
@@ -271,6 +271,8 @@ a Gomega object as their first parameter, and returns nothing, e.g. this is a va
}).WithTimeout(10 * time.Millisecond).WithPolling(time.Millisecond).Should(Succeed())
```
+***Note***: This rule **does not** support auto-fix.
+
### Avoid Spec Pollution: Don't Initialize Variables in Container Nodes [BUG/STYLE]:
***Note***: Only applied when the `--forbid-spec-pollution=true` flag is set (disabled by default).
@@ -522,6 +524,8 @@ will trigger a warning with a suggestion to replace the mather to
```
***This rule is disabled by default***. Use the `--force-succeed=true` command line flag to enable it.
+***Note***: This rule **does** support auto-fix, when the `--fix` command line parameter is used.
+
## Suppress the linter
### Suppress warning from command line
* Use the `--suppress-len-assertion=true` flag to suppress the wrong length and cap assertions warning
diff --git a/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actual.go b/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actual.go
index 8e3df5d3f..c289b24de 100644
--- a/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actual.go
+++ b/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actual.go
@@ -21,13 +21,13 @@ type Actual struct {
actualOffset int
}
-func New(origExpr, cloneExpr *ast.CallExpr, orig *ast.CallExpr, clone *ast.CallExpr, pass *analysis.Pass, handler gomegahandler.Handler, timePkg string) (*Actual, bool) {
+func New(origExpr, cloneExpr *ast.CallExpr, orig *ast.CallExpr, clone *ast.CallExpr, pass *analysis.Pass, handler gomegahandler.Handler, timePkg string, errMethodExists bool) (*Actual, bool) {
funcName, ok := handler.GetActualFuncName(orig)
if !ok {
return nil, false
}
- arg, actualOffset := getActualArgPayload(orig, clone, pass, funcName)
+ arg, actualOffset := getActualArgPayload(orig, clone, pass, funcName, errMethodExists)
if arg == nil {
return nil, false
}
diff --git a/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actualarg.go b/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actualarg.go
index 9d251c468..541a22330 100644
--- a/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actualarg.go
+++ b/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/actual/actualarg.go
@@ -28,6 +28,7 @@ const (
ErrFuncActualArgType
GomegaParamArgType
MultiRetsArgType
+ ErrorMethodArgType
ErrorTypeArgType
@@ -39,7 +40,7 @@ func (a ArgType) Is(val ArgType) bool {
return a&val != 0
}
-func getActualArgPayload(origActualExpr, actualExprClone *ast.CallExpr, pass *analysis.Pass, actualMethodName string) (ArgPayload, int) {
+func getActualArgPayload(origActualExpr, actualExprClone *ast.CallExpr, pass *analysis.Pass, actualMethodName string, errMethodExists bool) (ArgPayload, int) {
origArgExpr, argExprClone, actualOffset, isGomegaExpr := getActualArg(origActualExpr, actualExprClone, actualMethodName, pass)
if !isGomegaExpr {
return nil, 0
@@ -47,7 +48,9 @@ func getActualArgPayload(origActualExpr, actualExprClone *ast.CallExpr, pass *an
var arg ArgPayload
- if value.IsExprError(pass, origArgExpr) {
+ if errMethodExists {
+ arg = &ErrorMethodPayload{}
+ } else if value.IsExprError(pass, origArgExpr) {
arg = newErrPayload(origArgExpr, argExprClone, pass)
} else {
switch expr := origArgExpr.(type) {
@@ -56,12 +59,6 @@ func getActualArgPayload(origActualExpr, actualExprClone *ast.CallExpr, pass *an
case *ast.BinaryExpr:
arg = parseBinaryExpr(expr, argExprClone.(*ast.BinaryExpr), pass)
-
- default:
- t := pass.TypesInfo.TypeOf(origArgExpr)
- if sig, ok := t.(*gotypes.Signature); ok {
- arg = getAsyncFuncArg(sig)
- }
}
}
@@ -70,6 +67,14 @@ func getActualArgPayload(origActualExpr, actualExprClone *ast.CallExpr, pass *an
return arg, actualOffset
}
+ t := pass.TypesInfo.TypeOf(origArgExpr)
+ if sig, ok := t.(*gotypes.Signature); ok {
+ arg = getAsyncFuncArg(sig)
+ if arg != nil {
+ return arg, actualOffset
+ }
+ }
+
return newRegularArgPayload(origArgExpr, argExprClone, pass), actualOffset
}
@@ -181,6 +186,12 @@ func (*ErrPayload) ArgType() ArgType {
return ErrActualArgType | ErrorTypeArgType
}
+type ErrorMethodPayload struct{}
+
+func (ErrorMethodPayload) ArgType() ArgType {
+ return ErrorMethodArgType | ErrorTypeArgType
+}
+
func parseBinaryExpr(origActualExpr, argExprClone *ast.BinaryExpr, pass *analysis.Pass) ArgPayload {
left, right, op := origActualExpr.X, origActualExpr.Y, origActualExpr.Op
replace := false
diff --git a/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/expression.go b/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/expression.go
index 976e726fc..c2aa702b1 100644
--- a/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/expression.go
+++ b/vendor/github.com/nunnatsa/ginkgolinter/internal/expression/expression.go
@@ -52,7 +52,9 @@ func New(origExpr *ast.CallExpr, pass *analysis.Pass, handler gomegahandler.Hand
exprClone := astcopy.CallExpr(origExpr)
selClone := exprClone.Fun.(*ast.SelectorExpr)
- origActual := handler.GetActualExpr(origSel)
+ errMethodExists := false
+
+ origActual := handler.GetActualExpr(origSel, &errMethodExists)
if origActual == nil {
return nil, false
}
@@ -62,7 +64,7 @@ func New(origExpr *ast.CallExpr, pass *analysis.Pass, handler gomegahandler.Hand
return nil, false
}
- actl, ok := actual.New(origExpr, exprClone, origActual, actualClone, pass, handler, timePkg)
+ actl, ok := actual.New(origExpr, exprClone, origActual, actualClone, pass, handler, timePkg, errMethodExists)
if !ok {
return nil, false
}
diff --git a/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/dothandler.go b/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/dothandler.go
index bd3b93992..c853ca906 100644
--- a/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/dothandler.go
+++ b/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/dothandler.go
@@ -51,7 +51,7 @@ func (dotHandler) GetNewWrapperMatcher(name string, existing *ast.CallExpr) *ast
}
}
-func (h dotHandler) GetActualExpr(assertionFunc *ast.SelectorExpr) *ast.CallExpr {
+func (h dotHandler) GetActualExpr(assertionFunc *ast.SelectorExpr, errMethodExists *bool) *ast.CallExpr {
actualExpr, ok := assertionFunc.X.(*ast.CallExpr)
if !ok {
return nil
@@ -66,7 +66,11 @@ func (h dotHandler) GetActualExpr(assertionFunc *ast.SelectorExpr) *ast.CallExpr
return actualExpr
}
} else {
- return h.GetActualExpr(fun)
+ if fun.Sel.Name == "Error" {
+ *errMethodExists = true
+ }
+
+ return h.GetActualExpr(fun, errMethodExists)
}
}
return nil
diff --git a/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/handler.go b/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/handler.go
index 4dba604a4..414438ba6 100644
--- a/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/handler.go
+++ b/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/handler.go
@@ -18,7 +18,7 @@ type Handler interface {
// ReplaceFunction replaces the function with another one, for fix suggestions
ReplaceFunction(*ast.CallExpr, *ast.Ident)
- GetActualExpr(assertionFunc *ast.SelectorExpr) *ast.CallExpr
+ GetActualExpr(assertionFunc *ast.SelectorExpr, errMethodExists *bool) *ast.CallExpr
GetActualExprClone(origFunc, funcClone *ast.SelectorExpr) *ast.CallExpr
diff --git a/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/namedhandler.go b/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/namedhandler.go
index 712442426..66d563311 100644
--- a/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/namedhandler.go
+++ b/vendor/github.com/nunnatsa/ginkgolinter/internal/gomegahandler/namedhandler.go
@@ -51,7 +51,7 @@ func (g nameHandler) isGomegaVar(x ast.Expr) bool {
return gomegainfo.IsGomegaVar(x, g.pass)
}
-func (g nameHandler) GetActualExpr(assertionFunc *ast.SelectorExpr) *ast.CallExpr {
+func (g nameHandler) GetActualExpr(assertionFunc *ast.SelectorExpr, errMethodExists *bool) *ast.CallExpr {
actualExpr, ok := assertionFunc.X.(*ast.CallExpr)
if !ok {
return nil
@@ -69,7 +69,10 @@ func (g nameHandler) GetActualExpr(assertionFunc *ast.SelectorExpr) *ast.CallExp
return actualExpr
}
} else {
- return g.GetActualExpr(fun)
+ if fun.Sel.Name == "Error" {
+ *errMethodExists = true
+ }
+ return g.GetActualExpr(fun, errMethodExists)
}
}
return nil
diff --git a/vendor/github.com/nunnatsa/ginkgolinter/internal/rules/errorequalnilrule.go b/vendor/github.com/nunnatsa/ginkgolinter/internal/rules/errorequalnilrule.go
index 7aaf7631b..81932cc2c 100644
--- a/vendor/github.com/nunnatsa/ginkgolinter/internal/rules/errorequalnilrule.go
+++ b/vendor/github.com/nunnatsa/ginkgolinter/internal/rules/errorequalnilrule.go
@@ -12,8 +12,15 @@ import (
type ErrorEqualNilRule struct{}
func (ErrorEqualNilRule) isApplied(gexp *expression.GomegaExpression, config types.Config) bool {
- return !bool(config.SuppressErr) &&
- gexp.ActualArgTypeIs(actual.ErrorTypeArgType) &&
+ if config.SuppressErr {
+ return false
+ }
+
+ if !gexp.IsAsync() && gexp.ActualArgTypeIs(actual.FuncSigArgType) {
+ return false
+ }
+
+ return gexp.ActualArgTypeIs(actual.ErrorTypeArgType) &&
gexp.MatcherTypeIs(matcher.BeNilMatcherType|matcher.EqualNilMatcherType)
}
diff --git a/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go b/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go
index cf481708a..c639af6f3 100644
--- a/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go
+++ b/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go
@@ -53,6 +53,7 @@ func setDefaultAllowedErrors() {
{Err: "io.EOF", Fun: "(*io.SectionReader).Read"},
{Err: "io.EOF", Fun: "(*io.SectionReader).ReadAt"},
{Err: "io.ErrClosedPipe", Fun: "(*io.PipeWriter).Write"},
+ {Err: "io.EOF", Fun: "io.ReadAtLeast"},
{Err: "io.ErrShortBuffer", Fun: "io.ReadAtLeast"},
{Err: "io.ErrUnexpectedEOF", Fun: "io.ReadAtLeast"},
{Err: "io.EOF", Fun: "io.ReadFull"},
@@ -84,6 +85,7 @@ func setDefaultAllowedErrors() {
{Err: "context.Canceled", Fun: "(context.Context).Err"},
// pkg/encoding/json
{Err: "io.EOF", Fun: "(*encoding/json.Decoder).Decode"},
+ {Err: "io.EOF", Fun: "(*encoding/json.Decoder).Token"},
// pkg/encoding/csv
{Err: "io.EOF", Fun: "(*encoding/csv.Reader).Read"},
// pkg/mime/multipart
diff --git a/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go b/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go
index 9ac465c65..ed3dd0dc6 100644
--- a/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go
+++ b/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go
@@ -82,7 +82,7 @@ func LintFmtErrorfCalls(fset *token.FileSet, info types.Info, multipleWraps bool
argIndex++
}
- if verb.format == "w" {
+ if verb.format == "w" || verb.format == "T" {
continue
}
if argIndex-1 >= len(args) {
diff --git a/vendor/github.com/uudashr/iface/opaque/opaque.go b/vendor/github.com/uudashr/iface/opaque/opaque.go
index fda0f001b..f8b7bf4c6 100644
--- a/vendor/github.com/uudashr/iface/opaque/opaque.go
+++ b/vendor/github.com/uudashr/iface/opaque/opaque.go
@@ -53,6 +53,11 @@ func (r *runner) run(pass *analysis.Pass) (interface{}, error) {
return
}
+ if funcDecl.Body == nil {
+ // skip functions without body
+ return
+ }
+
if funcDecl.Type.Results == nil {
// skip functions without return values
return
@@ -133,7 +138,7 @@ func (r *runner) run(pass *analysis.Pass) (interface{}, error) {
typ := pass.TypesInfo.TypeOf(res)
switch typ := typ.(type) {
case *types.Tuple:
- for i := 0; i < typ.Len(); i++ {
+ for i := range typ.Len() {
v := typ.At(i)
vTyp := v.Type()
retStmtTypes[i][vTyp] = struct{}{}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 444df005c..58053fb5a 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -116,7 +116,7 @@ github.com/Antonboom/errname/pkg/analyzer
# github.com/Antonboom/nilnil v1.0.0
## explicit; go 1.22.0
github.com/Antonboom/nilnil/pkg/analyzer
-# github.com/Antonboom/testifylint v1.5.0
+# github.com/Antonboom/testifylint v1.5.2
## explicit; go 1.22.1
github.com/Antonboom/testifylint/analyzer
github.com/Antonboom/testifylint/internal/analysisutil
@@ -128,7 +128,7 @@ github.com/Antonboom/testifylint/internal/testify
## explicit; go 1.18
github.com/BurntSushi/toml
github.com/BurntSushi/toml/internal
-# github.com/Crocmagnon/fatcontext v0.5.2
+# github.com/Crocmagnon/fatcontext v0.5.3
## explicit; go 1.22.0
github.com/Crocmagnon/fatcontext/pkg/analyzer
# github.com/Djarvur/go-err113 v0.1.0
@@ -448,7 +448,7 @@ github.com/golangci/go-printf-func-name/pkg/analyzer
github.com/golangci/gofmt/gofmt
github.com/golangci/gofmt/gofmt/internal/diff
github.com/golangci/gofmt/goimports
-# github.com/golangci/golangci-lint v1.62.0
+# github.com/golangci/golangci-lint v1.62.2
## explicit; go 1.22.1
github.com/golangci/golangci-lint/cmd/golangci-lint
github.com/golangci/golangci-lint/internal/cache
@@ -803,7 +803,7 @@ github.com/mattn/go-isatty
# github.com/mattn/go-runewidth v0.0.16
## explicit; go 1.9
github.com/mattn/go-runewidth
-# github.com/mgechev/revive v1.5.0
+# github.com/mgechev/revive v1.5.1
## explicit; go 1.22.1
github.com/mgechev/revive/config
github.com/mgechev/revive/formatter
@@ -834,7 +834,7 @@ github.com/nishanths/exhaustive
# github.com/nishanths/predeclared v0.2.2
## explicit; go 1.14
github.com/nishanths/predeclared/passes/predeclared
-# github.com/nunnatsa/ginkgolinter v0.18.0
+# github.com/nunnatsa/ginkgolinter v0.18.3
## explicit; go 1.22.0
github.com/nunnatsa/ginkgolinter
github.com/nunnatsa/ginkgolinter/internal/expression
@@ -882,7 +882,7 @@ github.com/planetscale/vtprotobuf/types/known/wrapperspb
# github.com/pmezard/go-difflib v1.0.0
## explicit
github.com/pmezard/go-difflib/difflib
-# github.com/polyfloyd/go-errorlint v1.6.0
+# github.com/polyfloyd/go-errorlint v1.7.0
## explicit; go 1.20
github.com/polyfloyd/go-errorlint/errorlint
# github.com/prometheus/client_golang v1.20.5
@@ -1094,8 +1094,8 @@ github.com/ultraware/whitespace
# github.com/uudashr/gocognit v1.1.3
## explicit; go 1.18
github.com/uudashr/gocognit
-# github.com/uudashr/iface v1.2.0
-## explicit; go 1.21.0
+# github.com/uudashr/iface v1.2.1
+## explicit; go 1.22.1
github.com/uudashr/iface/identical
github.com/uudashr/iface/internal/directive
github.com/uudashr/iface/opaque
@@ -1219,7 +1219,7 @@ golang.org/x/crypto/internal/poly1305
## explicit; go 1.22.0
golang.org/x/exp/constraints
golang.org/x/exp/maps
-# golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0
+# golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f
## explicit; go 1.18
golang.org/x/exp/typeparams
# golang.org/x/mod v0.22.0