From 35711b99cb709f4b25d8783831acec783c50e912 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 17:49:55 +0000 Subject: [PATCH] build(deps): bump github.com/golangci/golangci-lint in /tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.59.0 to 1.59.1. - [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.59.0...v1.59.1) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- tools/go.mod | 16 +- tools/go.sum | 32 +- .../testifylint/internal/checkers/compares.go | 34 +- .../internal/checkers/helpers_basic_type.go | 5 + .../internal/checkers/helpers_error.go | 2 +- .../go-viper/mapstructure/v2/.envrc | 4 +- .../go-viper/mapstructure/v2/CHANGELOG.md | 3 + .../go-viper/mapstructure/v2/README.md | 21 ++ .../go-viper/mapstructure/v2/decode_hooks.go | 243 ++++++++++++++ .../go-viper/mapstructure/v2/error.go | 50 --- .../go-viper/mapstructure/v2/flake.lock | 303 +++++++++++++++--- .../mapstructure/v2/internal/errors/errors.go | 11 + .../mapstructure/v2/internal/errors/join.go | 9 + .../v2/internal/errors/join_go1_19.go | 61 ++++ .../go-viper/mapstructure/v2/mapstructure.go | 86 ++--- .../golangci-lint/pkg/commands/run.go | 6 +- .../golangci-lint/pkg/commands/version.go | 8 +- .../golangci-lint/pkg/config/config.go | 2 +- .../golangci-lint/pkg/golinters/gci/gci.go | 2 +- .../golangci-lint/pkg/golinters/mnd/mnd.go | 4 +- .../golinters/nolintlint/internal/README.md | 6 +- .../pkg/lint/lintersdb/builder_linter.go | 1 + .../pkg/printers/githubaction.go | 2 +- .../golangci-lint/pkg/printers/sarif.go | 7 +- .../pkg/result/processors/path_prettifier.go | 9 +- .../golangci/misspell/.pre-commit-hooks.yaml | 8 + .../github.com/golangci/misspell/README.md | 17 + .../golangci/misspell/goreleaser.yml | 11 +- .../golangci/misspell/install-misspell.sh | 244 +++++++------- .../go-errorlint/errorlint/allowed.go | 4 +- .../polyfloyd/go-errorlint/errorlint/lint.go | 49 +-- .../usestdlibvars/pkg/analyzer/analyzer.go | 72 +---- .../go-simpler.org/sloglint/sloglint.go | 3 +- tools/vendor/modules.txt | 19 +- tools/vendor/mvdan.cc/unparam/check/check.go | 11 +- 35 files changed, 954 insertions(+), 411 deletions(-) delete mode 100644 tools/vendor/github.com/go-viper/mapstructure/v2/error.go create mode 100644 tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/errors.go create mode 100644 tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/join.go create mode 100644 tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/join_go1_19.go create mode 100644 tools/vendor/github.com/golangci/misspell/.pre-commit-hooks.yaml diff --git a/tools/go.mod b/tools/go.mod index 95309731d8..415c70b220 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/cfergeau/gomod2rpmdeps v0.0.0-20210223144124-2042c4850ca8 - github.com/golangci/golangci-lint v1.59.0 + github.com/golangci/golangci-lint v1.59.1 github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 golang.org/x/tools v0.22.0 ) @@ -16,7 +16,7 @@ require ( github.com/Abirdcfly/dupword v0.0.14 // indirect github.com/Antonboom/errname v0.1.13 // indirect github.com/Antonboom/nilnil v0.1.9 // indirect - github.com/Antonboom/testifylint v1.3.0 // indirect + github.com/Antonboom/testifylint v1.3.1 // indirect github.com/BurntSushi/toml v1.4.0 // indirect github.com/Crocmagnon/fatcontext v0.2.2 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect @@ -62,14 +62,14 @@ require ( github.com/go-toolsmith/astp v1.1.0 // indirect github.com/go-toolsmith/strparse v1.1.0 // indirect github.com/go-toolsmith/typep v1.1.0 // indirect - github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect + github.com/go-viper/mapstructure/v2 v2.0.0 // indirect github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e // indirect - github.com/golangci/misspell v0.5.1 // indirect + github.com/golangci/misspell v0.6.0 // indirect github.com/golangci/modinfo v0.3.4 // indirect github.com/golangci/plugin-module-register v0.1.1 // indirect github.com/golangci/revgrep v0.5.3 // indirect @@ -122,7 +122,7 @@ require ( github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.5.1 // indirect + github.com/polyfloyd/go-errorlint v1.5.2 // indirect github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect @@ -137,7 +137,7 @@ require ( github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.25.0 // indirect + github.com/sashamelentyev/usestdlibvars v1.26.0 // indirect github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.3 // indirect @@ -172,7 +172,7 @@ require ( github.com/ykadowak/zerologlint v0.1.5 // indirect gitlab.com/bosi/decorder v0.4.2 // indirect go-simpler.org/musttag v0.12.2 // indirect - go-simpler.org/sloglint v0.7.0 // indirect + go-simpler.org/sloglint v0.7.1 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/automaxprocs v1.5.3 // indirect go.uber.org/multierr v1.6.0 // indirect @@ -190,5 +190,5 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.4.7 // indirect mvdan.cc/gofumpt v0.6.0 // indirect - mvdan.cc/unparam v0.0.0-20240427195214-063aff900ca1 // indirect + mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect ) diff --git a/tools/go.sum b/tools/go.sum index b6b725d230..92e5c9fc58 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -43,8 +43,8 @@ github.com/Antonboom/errname v0.1.13 h1:JHICqsewj/fNckzrfVSe+T33svwQxmjC+1ntDsHO github.com/Antonboom/errname v0.1.13/go.mod h1:uWyefRYRN54lBg6HseYCFhs6Qjcy41Y3Jl/dVhA87Ns= github.com/Antonboom/nilnil v0.1.9 h1:eKFMejSxPSA9eLSensFmjW2XTgTwJMjZ8hUHtV4s/SQ= github.com/Antonboom/nilnil v0.1.9/go.mod h1:iGe2rYwCq5/Me1khrysB4nwI7swQvjclR8/YRPl5ihQ= -github.com/Antonboom/testifylint v1.3.0 h1:UiqrddKs1W3YK8R0TUuWwrVKlVAnS07DTUVWWs9c+y4= -github.com/Antonboom/testifylint v1.3.0/go.mod h1:NV0hTlteCkViPW9mSR4wEMfwp+Hs1T3dY60bkvSfhpM= +github.com/Antonboom/testifylint v1.3.1 h1:Uam4q1Q+2b6H7gvk9RQFw6jyVDdpzIirFOOrbs14eG4= +github.com/Antonboom/testifylint v1.3.1/go.mod h1:NV0hTlteCkViPW9mSR4wEMfwp+Hs1T3dY60bkvSfhpM= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0= github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= @@ -186,8 +186,8 @@ github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQi github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= -github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 h1:TQcrn6Wq+sKGkpyPvppOz99zsMBaUOKXq6HSv655U1c= -github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc= +github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= @@ -228,10 +228,10 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/golangci-lint v1.59.0 h1:st69YDnAH/v2QXDcgUaZ0seQajHScPALBVkyitYLXEk= -github.com/golangci/golangci-lint v1.59.0/go.mod h1:QNA32UWdUdHXnu+Ap5/ZU4WVwyp2tL94UxEXrSErjg0= -github.com/golangci/misspell v0.5.1 h1:/SjR1clj5uDjNLwYzCahHwIOPmQgoH04AyQIiWGbhCM= -github.com/golangci/misspell v0.5.1/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= +github.com/golangci/golangci-lint v1.59.1 h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOId1h3TTks= +github.com/golangci/golangci-lint v1.59.1/go.mod h1:jX5Oif4C7P0j9++YB2MMJmoNrb01NJ8ITqKWNLewThg= +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= github.com/golangci/modinfo v0.3.4/go.mod h1:wytF1M5xl9u0ij8YSvhkEVPP3M5Mc7XLl1pxH3B2aUM= github.com/golangci/plugin-module-register v0.1.1 h1:TCmesur25LnyJkpsVrupv1Cdzo+2f7zX0H6Jkw1Ol6c= @@ -418,8 +418,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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.5.1 h1:5gHxDjLyyWij7fhfrjYNNlHsUNQeyx0LFQKUelO3RBo= -github.com/polyfloyd/go-errorlint v1.5.1/go.mod h1:sH1QC1pxxi0fFecsVIzBmxtrgd9IF/SkJpA6wqyKAJs= +github.com/polyfloyd/go-errorlint v1.5.2 h1:SJhVik3Umsjh7mte1vE0fVZ5T1gznasQG3PV7U5xFdA= +github.com/polyfloyd/go-errorlint v1.5.2/go.mod h1:sH1QC1pxxi0fFecsVIzBmxtrgd9IF/SkJpA6wqyKAJs= 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 v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -470,8 +470,8 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6Ng github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.25.0 h1:IK8SI2QyFzy/2OD2PYnhy84dpfNo9qADrRt6LH8vSzU= -github.com/sashamelentyev/usestdlibvars v1.25.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= +github.com/sashamelentyev/usestdlibvars v1.26.0 h1:LONR2hNVKxRmzIrZR0PhSF3mhCAzvnr+DcUiHgREfXE= +github.com/sashamelentyev/usestdlibvars v1.26.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 h1:rnO6Zp1YMQwv8AyxzuwsVohljJgp4L0ZqiCgtACsPsc= github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9/go.mod h1:dg7lPlu/xK/Ut9SedURCoZbVCR4yC7fM65DtH9/CDHs= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= @@ -570,8 +570,8 @@ go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ= go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= go-simpler.org/musttag v0.12.2 h1:J7lRc2ysXOq7eM8rwaTYnNrHd5JwjppzB6mScysB2Cs= go-simpler.org/musttag v0.12.2/go.mod h1:uN1DVIasMTQKk6XSik7yrJoEysGtR2GRqvWnI9S7TYM= -go-simpler.org/sloglint v0.7.0 h1:rMZRxD9MbaGoRFobIOicMxZzum7AXNFDlez6xxJs5V4= -go-simpler.org/sloglint v0.7.0/go.mod h1:g9SXiSWY0JJh4LS39/Q0GxzP/QX2cVcbTOYhDpXrJEs= +go-simpler.org/sloglint v0.7.1 h1:qlGLiqHbN5islOxjeLXoPtUdZXb669RW+BDQ+xOSNoU= +go-simpler.org/sloglint v0.7.1/go.mod h1:OlaVDRh/FKKd4X4sIMbsz8st97vomydceL146Fthh/c= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -953,8 +953,8 @@ honnef.co/go/tools v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs= honnef.co/go/tools v0.4.7/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA= -mvdan.cc/unparam v0.0.0-20240427195214-063aff900ca1 h1:Nykk7fggxChwLK4rUPYESzeIwqsuxXXlFEAh5YhaMRo= -mvdan.cc/unparam v0.0.0-20240427195214-063aff900ca1/go.mod h1:ZzZjEpJDOmx8TdVU6umamY3Xy0UAQUI2DHbf05USVbI= +mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U= +mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f/go.mod h1:RSLa7mKKCNeTTMHBw5Hsy2rfJmd6O2ivt9Dw9ZqCQpQ= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/compares.go b/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/compares.go index 3493a19921..bdde03d95e 100644 --- a/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/compares.go +++ b/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/compares.go @@ -26,6 +26,9 @@ import ( // assert.GreaterOrEqual(t, a, b) // assert.Less(t, a, b) // assert.LessOrEqual(t, a, b) +// +// If `a` and `b` are pointers then `assert.Same`/`NotSame` is required instead, +// due to the inappropriate recursive nature of `assert.Equal` (based on `reflect.DeepEqual`). type Compares struct{} // NewCompares constructs Compares checker. @@ -53,17 +56,28 @@ func (checker Compares) Check(pass *analysis.Pass, call *CallMeta) *analysis.Dia return nil } - if proposedFn, ok := tokenToProposedFn[be.Op]; ok { - a, b := be.X, be.Y - return newUseFunctionDiagnostic(checker.Name(), call, proposedFn, - newSuggestedFuncReplacement(call, proposedFn, analysis.TextEdit{ - Pos: be.X.Pos(), - End: be.Y.End(), - NewText: formatAsCallArgs(pass, a, b), - }), - ) + proposedFn, ok := tokenToProposedFn[be.Op] + if !ok { + return nil + } + + if isPointer(pass, be.X) && isPointer(pass, be.Y) { + switch proposedFn { + case "Equal": + proposedFn = "Same" + case "NotEqual": + proposedFn = "NotSame" + } } - return nil + + a, b := be.X, be.Y + return newUseFunctionDiagnostic(checker.Name(), call, proposedFn, + newSuggestedFuncReplacement(call, proposedFn, analysis.TextEdit{ + Pos: be.X.Pos(), + End: be.Y.End(), + NewText: formatAsCallArgs(pass, a, b), + }), + ) } var tokenToProposedFnInsteadOfTrue = map[token.Token]string{ diff --git a/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_basic_type.go b/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_basic_type.go index 6e5b20c2dd..34dcb475f3 100644 --- a/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_basic_type.go +++ b/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_basic_type.go @@ -54,3 +54,8 @@ func isFloat(pass *analysis.Pass, expr ast.Expr) bool { bt, ok := t.Underlying().(*types.Basic) return ok && (bt.Info()&types.IsFloat > 0) } + +func isPointer(pass *analysis.Pass, expr ast.Expr) bool { + _, ok := pass.TypesInfo.TypeOf(expr).(*types.Pointer) + return ok +} diff --git a/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_error.go b/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_error.go index ce5e918bf5..55cd5fd05a 100644 --- a/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_error.go +++ b/tools/vendor/github.com/Antonboom/testifylint/internal/checkers/helpers_error.go @@ -16,7 +16,7 @@ var ( ) func isError(pass *analysis.Pass, expr ast.Expr) bool { - return implements(pass, expr, errorObj) + return pass.TypesInfo.TypeOf(expr) == errorType } func isErrorsIsCall(pass *analysis.Pass, ce *ast.CallExpr) bool { diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/.envrc b/tools/vendor/github.com/go-viper/mapstructure/v2/.envrc index c66fc0d354..2e0f9f5f71 100644 --- a/tools/vendor/github.com/go-viper/mapstructure/v2/.envrc +++ b/tools/vendor/github.com/go-viper/mapstructure/v2/.envrc @@ -1,4 +1,4 @@ -if ! has nix_direnv_version || ! nix_direnv_version 3.0.1; then - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.1/direnvrc" "sha256-17G+Mvt/JsyJrwsf7bqMr7ho7liHP+0Lo4RMIHgp0F8=" +if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4=" fi use flake . --impure diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/CHANGELOG.md b/tools/vendor/github.com/go-viper/mapstructure/v2/CHANGELOG.md index ae634d1cc0..afd44e5f5f 100644 --- a/tools/vendor/github.com/go-viper/mapstructure/v2/CHANGELOG.md +++ b/tools/vendor/github.com/go-viper/mapstructure/v2/CHANGELOG.md @@ -1,3 +1,6 @@ +> [!WARNING] +> As of v2 of this library, change log can be found in GitHub releases. + ## 1.5.1 * Wrap errors so they're compatible with `errors.Is` and `errors.As` [GH-282] diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/README.md b/tools/vendor/github.com/go-viper/mapstructure/v2/README.md index 2b28db8948..dd5ec69ddf 100644 --- a/tools/vendor/github.com/go-viper/mapstructure/v2/README.md +++ b/tools/vendor/github.com/go-viper/mapstructure/v2/README.md @@ -19,6 +19,27 @@ structure. go get github.com/go-viper/mapstructure/v2 ``` +## Migrating from `github.com/mitchellh/mapstructure` + +[@mitchehllh](https://github.com/mitchellh) announced his intent to archive some of his unmaintained projects (see [here](https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc) and [here](https://github.com/mitchellh/mapstructure/issues/349)). This is a repository achieved the "blessed fork" status. + +You can migrate to this package by changing your import paths in your Go files to `github.com/go-viper/mapstructure/v2`. +The API is the same, so you don't need to change anything else. + +Here is a script that can help you with the migration: + +```shell +sed -i 's/github.com\/mitchellh\/mapstructure/github.com\/go-viper\/mapstructure\/v2/g' $(find . -type f -name '*.go') +``` + +If you need more time to migrate your code, that is absolutely fine. + +Some of the latest fixes are backported to the v1 release branch of this package, so you can use the Go modules `replace` feature until you are ready to migrate: + +```shell +replace github.com/mitchellh/mapstructure => github.com/go-viper/mapstructure v1.6.0 +``` + ## Usage & Example For usage and examples see the [documentation](https://pkg.go.dev/mod/github.com/go-viper/mapstructure/v2). diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go b/tools/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go index 840d6adce0..24d82f07c3 100644 --- a/tools/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go +++ b/tools/vendor/github.com/go-viper/mapstructure/v2/decode_hooks.go @@ -332,3 +332,246 @@ func StringToNetIPAddrPortHookFunc() DecodeHookFunc { return netip.ParseAddrPort(data.(string)) } } + +// StringToBasicTypeHookFunc returns a DecodeHookFunc that converts +// strings to basic types. +// int8, uint8, int16, uint16, int32, uint32, int64, uint64, int, uint, float32, float64, bool, byte, rune, complex64, complex128 +func StringToBasicTypeHookFunc() DecodeHookFunc { + return ComposeDecodeHookFunc( + StringToInt8HookFunc(), + StringToUint8HookFunc(), + StringToInt16HookFunc(), + StringToUint16HookFunc(), + StringToInt32HookFunc(), + StringToUint32HookFunc(), + StringToInt64HookFunc(), + StringToUint64HookFunc(), + StringToIntHookFunc(), + StringToUintHookFunc(), + StringToFloat32HookFunc(), + StringToFloat64HookFunc(), + StringToBoolHookFunc(), + // byte and rune are aliases for uint8 and int32 respectively + // StringToByteHookFunc(), + // StringToRuneHookFunc(), + StringToComplex64HookFunc(), + StringToComplex128HookFunc(), + ) +} + +// StringToInt8HookFunc returns a DecodeHookFunc that converts +// strings to int8. +func StringToInt8HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Int8 { + return data, nil + } + + // Convert it by parsing + i64, err := strconv.ParseInt(data.(string), 0, 8) + return int8(i64), err + } +} + +// StringToUint8HookFunc returns a DecodeHookFunc that converts +// strings to uint8. +func StringToUint8HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Uint8 { + return data, nil + } + + // Convert it by parsing + u64, err := strconv.ParseUint(data.(string), 0, 8) + return uint8(u64), err + } +} + +// StringToInt16HookFunc returns a DecodeHookFunc that converts +// strings to int16. +func StringToInt16HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Int16 { + return data, nil + } + + // Convert it by parsing + i64, err := strconv.ParseInt(data.(string), 0, 16) + return int16(i64), err + } +} + +// StringToUint16HookFunc returns a DecodeHookFunc that converts +// strings to uint16. +func StringToUint16HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Uint16 { + return data, nil + } + + // Convert it by parsing + u64, err := strconv.ParseUint(data.(string), 0, 16) + return uint16(u64), err + } +} + +// StringToInt32HookFunc returns a DecodeHookFunc that converts +// strings to int32. +func StringToInt32HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Int32 { + return data, nil + } + + // Convert it by parsing + i64, err := strconv.ParseInt(data.(string), 0, 32) + return int32(i64), err + } +} + +// StringToUint32HookFunc returns a DecodeHookFunc that converts +// strings to uint32. +func StringToUint32HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Uint32 { + return data, nil + } + + // Convert it by parsing + u64, err := strconv.ParseUint(data.(string), 0, 32) + return uint32(u64), err + } +} + +// StringToInt64HookFunc returns a DecodeHookFunc that converts +// strings to int64. +func StringToInt64HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Int64 { + return data, nil + } + + // Convert it by parsing + return strconv.ParseInt(data.(string), 0, 64) + } +} + +// StringToUint64HookFunc returns a DecodeHookFunc that converts +// strings to uint64. +func StringToUint64HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Uint64 { + return data, nil + } + + // Convert it by parsing + return strconv.ParseUint(data.(string), 0, 64) + } +} + +// StringToIntHookFunc returns a DecodeHookFunc that converts +// strings to int. +func StringToIntHookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Int { + return data, nil + } + + // Convert it by parsing + i64, err := strconv.ParseInt(data.(string), 0, 0) + return int(i64), err + } +} + +// StringToUintHookFunc returns a DecodeHookFunc that converts +// strings to uint. +func StringToUintHookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Uint { + return data, nil + } + + // Convert it by parsing + u64, err := strconv.ParseUint(data.(string), 0, 0) + return uint(u64), err + } +} + +// StringToFloat32HookFunc returns a DecodeHookFunc that converts +// strings to float32. +func StringToFloat32HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Float32 { + return data, nil + } + + // Convert it by parsing + f64, err := strconv.ParseFloat(data.(string), 32) + return float32(f64), err + } +} + +// StringToFloat64HookFunc returns a DecodeHookFunc that converts +// strings to float64. +func StringToFloat64HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Float64 { + return data, nil + } + + // Convert it by parsing + return strconv.ParseFloat(data.(string), 64) + } +} + +// StringToBoolHookFunc returns a DecodeHookFunc that converts +// strings to bool. +func StringToBoolHookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Bool { + return data, nil + } + + // Convert it by parsing + return strconv.ParseBool(data.(string)) + } +} + +// StringToByteHookFunc returns a DecodeHookFunc that converts +// strings to byte. +func StringToByteHookFunc() DecodeHookFunc { + return StringToUint8HookFunc() +} + +// StringToRuneHookFunc returns a DecodeHookFunc that converts +// strings to rune. +func StringToRuneHookFunc() DecodeHookFunc { + return StringToInt32HookFunc() +} + +// StringToComplex64HookFunc returns a DecodeHookFunc that converts +// strings to complex64. +func StringToComplex64HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Complex64 { + return data, nil + } + + // Convert it by parsing + c128, err := strconv.ParseComplex(data.(string), 64) + return complex64(c128), err + } +} + +// StringToComplex128HookFunc returns a DecodeHookFunc that converts +// strings to complex128. +func StringToComplex128HookFunc() DecodeHookFunc { + return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { + if f.Kind() != reflect.String || t.Kind() != reflect.Complex128 { + return data, nil + } + + // Convert it by parsing + return strconv.ParseComplex(data.(string), 128) + } +} diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/error.go b/tools/vendor/github.com/go-viper/mapstructure/v2/error.go deleted file mode 100644 index 47a99e5af3..0000000000 --- a/tools/vendor/github.com/go-viper/mapstructure/v2/error.go +++ /dev/null @@ -1,50 +0,0 @@ -package mapstructure - -import ( - "errors" - "fmt" - "sort" - "strings" -) - -// Error implements the error interface and can represents multiple -// errors that occur in the course of a single decode. -type Error struct { - Errors []string -} - -func (e *Error) Error() string { - points := make([]string, len(e.Errors)) - for i, err := range e.Errors { - points[i] = fmt.Sprintf("* %s", err) - } - - sort.Strings(points) - return fmt.Sprintf( - "%d error(s) decoding:\n\n%s", - len(e.Errors), strings.Join(points, "\n")) -} - -// WrappedErrors implements the errwrap.Wrapper interface to make this -// return value more useful with the errwrap and go-multierror libraries. -func (e *Error) WrappedErrors() []error { - if e == nil { - return nil - } - - result := make([]error, len(e.Errors)) - for i, e := range e.Errors { - result[i] = errors.New(e) - } - - return result -} - -func appendErrors(errors []string, err error) []string { - switch e := err.(type) { - case *Error: - return append(errors, e.Errors...) - default: - return append(errors, e.Error()) - } -} diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/flake.lock b/tools/vendor/github.com/go-viper/mapstructure/v2/flake.lock index 5a387d3299..4bea8154e0 100644 --- a/tools/vendor/github.com/go-viper/mapstructure/v2/flake.lock +++ b/tools/vendor/github.com/go-viper/mapstructure/v2/flake.lock @@ -1,22 +1,84 @@ { "nodes": { + "cachix": { + "inputs": { + "devenv": "devenv_2", + "flake-compat": [ + "devenv", + "flake-compat" + ], + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "pre-commit-hooks": [ + "devenv", + "pre-commit-hooks" + ] + }, + "locked": { + "lastModified": 1712055811, + "narHash": "sha256-7FcfMm5A/f02yyzuavJe06zLa9hcMHsagE28ADcmQvk=", + "owner": "cachix", + "repo": "cachix", + "rev": "02e38da89851ec7fec3356a5c04bc8349cae0e30", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "cachix", + "type": "github" + } + }, "devenv": { "inputs": { - "flake-compat": "flake-compat", + "cachix": "cachix", + "flake-compat": "flake-compat_2", + "nix": "nix_2", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1717245169, + "narHash": "sha256-+mW3rTBjGU8p1THJN0lX/Dd/8FbnF+3dB+mJuSaxewE=", + "owner": "cachix", + "repo": "devenv", + "rev": "c3f9f053c077c6f88a3de5276d9178c62baa3fc3", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv_2": { + "inputs": { + "flake-compat": [ + "devenv", + "cachix", + "flake-compat" + ], "nix": "nix", "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks" + "poetry2nix": "poetry2nix", + "pre-commit-hooks": [ + "devenv", + "cachix", + "pre-commit-hooks" + ] }, "locked": { - "lastModified": 1702549996, - "narHash": "sha256-mEN+8gjWUXRxBCcixeth+jlDNuzxbpFwZNOEc4K22vw=", + "lastModified": 1708704632, + "narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=", "owner": "cachix", "repo": "devenv", - "rev": "e681a99ffe2d2882f413a5d771129223c838ddce", + "rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196", "type": "github" }, "original": { "owner": "cachix", + "ref": "python-rewrite", "repo": "devenv", "type": "github" } @@ -37,16 +99,32 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1701473968, - "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", "type": "github" }, "original": { @@ -60,11 +138,29 @@ "systems": "systems" }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -82,11 +178,11 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -95,53 +191,90 @@ "type": "github" } }, - "lowdown-src": { - "flake": false, + "nix": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression" + }, "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "lastModified": 1712911606, + "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", + "owner": "domenkozar", + "repo": "nix", + "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", "type": "github" }, "original": { - "owner": "kristapsdz", - "repo": "lowdown", + "owner": "domenkozar", + "ref": "devenv-2.21", + "repo": "nix", "type": "github" } }, - "nix": { + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688870561, + "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix_2": { "inputs": { - "lowdown-src": "lowdown-src", + "flake-compat": [ + "devenv", + "flake-compat" + ], "nixpkgs": [ "devenv", "nixpkgs" ], - "nixpkgs-regression": "nixpkgs-regression" + "nixpkgs-regression": "nixpkgs-regression_2" }, "locked": { - "lastModified": 1676545802, - "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "lastModified": 1712911606, + "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", "owner": "domenkozar", "repo": "nix", - "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", "type": "github" }, "original": { "owner": "domenkozar", - "ref": "relaxed-flakes", + "ref": "devenv-2.21", "repo": "nix", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1678875422, - "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=", + "lastModified": 1692808169, + "narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459", + "rev": "9201b5ff357e781bf014d0330d18555695df7ba8", "type": "github" }, "original": { @@ -153,23 +286,33 @@ }, "nixpkgs-lib": { "locked": { - "dir": "lib", - "lastModified": 1701253981, - "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", "type": "github" }, "original": { - "dir": "lib", "owner": "NixOS", - "ref": "nixos-unstable", "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", "type": "github" } }, - "nixpkgs-regression": { + "nixpkgs-regression_2": { "locked": { "lastModified": 1643052045, "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", @@ -187,27 +330,43 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1702539185, - "narHash": "sha256-KnIRG5NMdLIpEkZTnN5zovNYc0hhXjAgv6pfd5Z4c7U=", + "lastModified": 1713361204, + "narHash": "sha256-TA6EDunWTkc5FvDCqU3W2T3SFn0gRZqh6D/hJnM02MM=", + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "285676e87ad9f0ca23d8714a6ab61e7e027020c6", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1717112898, + "narHash": "sha256-7R2ZvOnvd9h8fDd65p0JnB7wXfUvreox3xFdYWd1BnY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "aa9d4729cbc99dabacb50e3994dcefb3ea0f7447", + "rev": "6132b0f6e344ce2fe34fc051b72fb46e34f668e0", "type": "github" }, "original": { @@ -217,13 +376,38 @@ "type": "github" } }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1692876271, + "narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": [ "devenv", "flake-compat" ], - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "gitignore": "gitignore", "nixpkgs": [ "devenv", @@ -232,11 +416,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1688056373, - "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=", + "lastModified": 1713775815, + "narHash": "sha256-Wu9cdYTnGQQwtT20QQMg7jzkANKQjwBD9iccfGKkfls=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7", + "rev": "2ac4dcbf55ed43f3be0bae15e181f08a57af24a4", "type": "github" }, "original": { @@ -249,7 +433,7 @@ "inputs": { "devenv": "devenv", "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" } }, "systems": { @@ -266,6 +450,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/errors.go b/tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/errors.go new file mode 100644 index 0000000000..d1c15e474f --- /dev/null +++ b/tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/errors.go @@ -0,0 +1,11 @@ +package errors + +import "errors" + +func New(text string) error { + return errors.New(text) +} + +func As(err error, target interface{}) bool { + return errors.As(err, target) +} diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/join.go b/tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/join.go new file mode 100644 index 0000000000..d74e3a0b5a --- /dev/null +++ b/tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/join.go @@ -0,0 +1,9 @@ +//go:build go1.20 + +package errors + +import "errors" + +func Join(errs ...error) error { + return errors.Join(errs...) +} diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/join_go1_19.go b/tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/join_go1_19.go new file mode 100644 index 0000000000..700b40229c --- /dev/null +++ b/tools/vendor/github.com/go-viper/mapstructure/v2/internal/errors/join_go1_19.go @@ -0,0 +1,61 @@ +//go:build !go1.20 + +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package errors + +// Join returns an error that wraps the given errors. +// Any nil error values are discarded. +// Join returns nil if every value in errs is nil. +// The error formats as the concatenation of the strings obtained +// by calling the Error method of each element of errs, with a newline +// between each string. +// +// A non-nil error returned by Join implements the Unwrap() []error method. +func Join(errs ...error) error { + n := 0 + for _, err := range errs { + if err != nil { + n++ + } + } + if n == 0 { + return nil + } + e := &joinError{ + errs: make([]error, 0, n), + } + for _, err := range errs { + if err != nil { + e.errs = append(e.errs, err) + } + } + return e +} + +type joinError struct { + errs []error +} + +func (e *joinError) Error() string { + // Since Join returns nil if every value in errs is nil, + // e.errs cannot be empty. + if len(e.errs) == 1 { + return e.errs[0].Error() + } + + b := []byte(e.errs[0].Error()) + for _, err := range e.errs[1:] { + b = append(b, '\n') + b = append(b, err.Error()...) + } + // At this point, b has at least one byte '\n'. + // return unsafe.String(&b[0], len(b)) + return string(b) +} + +func (e *joinError) Unwrap() []error { + return e.errs +} diff --git a/tools/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go b/tools/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go index 27f21bc721..4b54fae087 100644 --- a/tools/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go +++ b/tools/vendor/github.com/go-viper/mapstructure/v2/mapstructure.go @@ -160,12 +160,13 @@ package mapstructure import ( "encoding/json" - "errors" "fmt" "reflect" "sort" "strconv" "strings" + + "github.com/go-viper/mapstructure/v2/internal/errors" ) // DecodeHookFunc is the callback function that can be used for @@ -414,7 +415,15 @@ func NewDecoder(config *DecoderConfig) (*Decoder, error) { // Decode decodes the given raw interface to the target pointer specified // by the configuration. func (d *Decoder) Decode(input interface{}) error { - return d.decode("", input, reflect.ValueOf(d.config.Result).Elem()) + err := d.decode("", input, reflect.ValueOf(d.config.Result).Elem()) + + // Retain some of the original behavior when multiple errors ocurr + var joinedErr interface{ Unwrap() []error } + if errors.As(err, &joinedErr) { + return fmt.Errorf("decoding failed due to the following error(s):\n\n%w", err) + } + + return err } // Decodes an unknown data type into a specific reflection value. @@ -478,6 +487,8 @@ func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) e err = d.decodeUint(name, input, outVal) case reflect.Float32: err = d.decodeFloat(name, input, outVal) + case reflect.Complex64: + err = d.decodeComplex(name, input, outVal) case reflect.Struct: err = d.decodeStruct(name, input, outVal) case reflect.Map: @@ -796,6 +807,22 @@ func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) return nil } +func (d *Decoder) decodeComplex(name string, data interface{}, val reflect.Value) error { + dataVal := reflect.Indirect(reflect.ValueOf(data)) + dataKind := getKind(dataVal) + + switch { + case dataKind == reflect.Complex64: + val.SetComplex(dataVal.Complex()) + default: + return fmt.Errorf( + "'%s' expected type '%s', got unconvertible type '%s', value: '%v'", + name, val.Type(), dataVal.Type(), data) + } + + return nil +} + func (d *Decoder) decodeMap(name string, data interface{}, val reflect.Value) error { valType := val.Type() valKeyType := valType.Key() @@ -863,7 +890,7 @@ func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val refle valElemType := valType.Elem() // Accumulate errors - errors := make([]string, 0) + var errs []error // If the input data is empty, then we just match what the input data is. if dataVal.Len() == 0 { @@ -885,7 +912,7 @@ func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val refle // First decode the key into the proper type currentKey := reflect.Indirect(reflect.New(valKeyType)) if err := d.decode(fieldName, k.Interface(), currentKey); err != nil { - errors = appendErrors(errors, err) + errs = append(errs, err) continue } @@ -893,7 +920,7 @@ func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val refle v := dataVal.MapIndex(k).Interface() currentVal := reflect.Indirect(reflect.New(valElemType)) if err := d.decode(fieldName, v, currentVal); err != nil { - errors = appendErrors(errors, err) + errs = append(errs, err) continue } @@ -903,12 +930,7 @@ func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val refle // Set the built up map to the value val.Set(valMap) - // If we had errors, return those - if len(errors) > 0 { - return &Error{errors} - } - - return nil + return errors.Join(errs...) } func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error { @@ -1146,7 +1168,7 @@ func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) } // Accumulate any errors - errors := make([]string, 0) + var errs []error for i := 0; i < dataVal.Len(); i++ { currentData := dataVal.Index(i).Interface() @@ -1157,19 +1179,14 @@ func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) fieldName := name + "[" + strconv.Itoa(i) + "]" if err := d.decode(fieldName, currentData, currentField); err != nil { - errors = appendErrors(errors, err) + errs = append(errs, err) } } // Finally, set the value to the slice we built up val.Set(valSlice) - // If there were errors, we return those - if len(errors) > 0 { - return &Error{errors} - } - - return nil + return errors.Join(errs...) } func (d *Decoder) decodeArray(name string, data interface{}, val reflect.Value) error { @@ -1215,7 +1232,7 @@ func (d *Decoder) decodeArray(name string, data interface{}, val reflect.Value) } // Accumulate any errors - errors := make([]string, 0) + var errs []error for i := 0; i < dataVal.Len(); i++ { currentData := dataVal.Index(i).Interface() @@ -1223,19 +1240,14 @@ func (d *Decoder) decodeArray(name string, data interface{}, val reflect.Value) fieldName := name + "[" + strconv.Itoa(i) + "]" if err := d.decode(fieldName, currentData, currentField); err != nil { - errors = appendErrors(errors, err) + errs = append(errs, err) } } // Finally, set the value to the array we built up val.Set(valArray) - // If there were errors, we return those - if len(errors) > 0 { - return &Error{errors} - } - - return nil + return errors.Join(errs...) } func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value) error { @@ -1297,7 +1309,8 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e } targetValKeysUnused := make(map[interface{}]struct{}) - errors := make([]string, 0) + + var errs []error // This slice will keep track of all the structs we'll be decoding. // There can be more than one struct if there are embedded structs @@ -1351,8 +1364,7 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e if squash { if fieldVal.Kind() != reflect.Struct { - errors = appendErrors(errors, - fmt.Errorf("%s: unsupported type for squash: %s", fieldType.Name, fieldVal.Kind())) + errs = append(errs, fmt.Errorf("%s: unsupported type for squash: %s", fieldType.Name, fieldVal.Kind())) } else { structs = append(structs, fieldVal) } @@ -1431,7 +1443,7 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e } if err := d.decode(fieldName, rawMapVal.Interface(), fieldValue); err != nil { - errors = appendErrors(errors, err) + errs = append(errs, err) } } @@ -1446,7 +1458,7 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e // Decode it as-if we were just decoding this map onto our map. if err := d.decodeMap(name, remain, remainField.val); err != nil { - errors = appendErrors(errors, err) + errs = append(errs, err) } // Set the map to nil so we have none so that the next check will @@ -1462,7 +1474,7 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e sort.Strings(keys) err := fmt.Errorf("'%s' has invalid keys: %s", name, strings.Join(keys, ", ")) - errors = appendErrors(errors, err) + errs = append(errs, err) } if d.config.ErrorUnset && len(targetValKeysUnused) > 0 { @@ -1473,11 +1485,11 @@ func (d *Decoder) decodeStructFromMap(name string, dataVal, val reflect.Value) e sort.Strings(keys) err := fmt.Errorf("'%s' has unset fields: %s", name, strings.Join(keys, ", ")) - errors = appendErrors(errors, err) + errs = append(errs, err) } - if len(errors) > 0 { - return &Error{errors} + if err := errors.Join(errs...); err != nil { + return err } // Add the unused keys to the list of unused keys if we're tracking metadata @@ -1531,6 +1543,8 @@ func getKind(val reflect.Value) reflect.Kind { return reflect.Uint case kind >= reflect.Float32 && kind <= reflect.Float64: return reflect.Float32 + case kind >= reflect.Complex64 && kind <= reflect.Complex128: + return reflect.Complex64 default: return kind } diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/commands/run.go b/tools/vendor/github.com/golangci/golangci-lint/pkg/commands/run.go index dc323f1017..bc086bc3d7 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/commands/run.go +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/commands/run.go @@ -152,6 +152,8 @@ func (c *runCommand) persistentPreRunE(cmd *cobra.Command, args []string) error return err } + c.log.Infof(c.buildInfo.String()) + loader := config.NewLoader(c.log.Child(logutils.DebugKeyConfigReader), c.viper, cmd.Flags(), c.opts.LoaderOptions, c.cfg, args) err := loader.Load(config.LoadOptions{CheckDeprecation: true, Validation: true}) @@ -171,7 +173,7 @@ func (c *runCommand) persistentPreRunE(cmd *cobra.Command, args []string) error runtime.GOMAXPROCS(c.cfg.Run.Concurrency) } - return c.startTracing() + return nil } func (c *runCommand) persistentPostRunE(_ *cobra.Command, _ []string) error { @@ -674,7 +676,7 @@ func computeBinarySalt(version string) ([]byte, error) { func computeConfigSalt(cfg *config.Config) ([]byte, error) { lintersSettingsBytes, err := yaml.Marshal(cfg.LintersSettings) if err != nil { - return nil, fmt.Errorf("failed to json marshal config linter settings: %w", err) + return nil, fmt.Errorf("failed to JSON marshal config linter settings: %w", err) } configData := bytes.NewBufferString("linters-settings=") diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/commands/version.go b/tools/vendor/github.com/golangci/golangci-lint/pkg/commands/version.go index a03e46e221..ac665f4c57 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/commands/version.go +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/commands/version.go @@ -19,6 +19,11 @@ type BuildInfo struct { Date string `json:"date"` } +func (b BuildInfo) String() string { + return fmt.Sprintf("golangci-lint has version %s built with %s from %s on %s", + b.Version, b.GoVersion, b.Commit, b.Date) +} + type versionInfo struct { Info BuildInfo BuildInfo *debug.BuildInfo @@ -92,7 +97,6 @@ func (c *versionCommand) execute(_ *cobra.Command, _ []string) error { } func printVersion(w io.Writer, info BuildInfo) error { - _, err := fmt.Fprintf(w, "golangci-lint has version %s built with %s from %s on %s\n", - info.Version, info.GoVersion, info.Commit, info.Date) + _, err := fmt.Fprintln(w, info.String()) return err } diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/config/config.go b/tools/vendor/github.com/golangci/golangci-lint/pkg/config/config.go index 59f6eef0da..1dd064013a 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/config/config.go +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/config/config.go @@ -9,7 +9,7 @@ import ( "github.com/ldez/gomoddirectives" ) -// Config encapsulates the config data specified in the golangci-lint yaml config file. +// Config encapsulates the config data specified in the golangci-lint YAML config file. type Config struct { cfgDir string // The directory containing the golangci-lint config file. diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/gci/gci.go b/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/gci/gci.go index 08733ca2f1..38ed2a0330 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/gci/gci.go +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/gci/gci.go @@ -194,7 +194,7 @@ func diffFormattedFilesToArray(paths []string, cfg gcicfg.Config, diffs *[]strin }) } -// Code bellow this comment is borrowed and modified from gci. +// Code below this comment is borrowed and modified from gci. // https://github.com/daixiang0/gci/blob/4725b0c101801e7449530eee2ddb0c72592e3405/pkg/config/config.go var defaultOrder = map[string]int{ diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/mnd/mnd.go b/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/mnd/mnd.go index ee73c535b6..9aa8692ff3 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/mnd/mnd.go +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/mnd/mnd.go @@ -25,7 +25,9 @@ func NewGoMND(settings *config.GoMndSettings) *goanalysis.Linter { if settings != nil && len(settings.Settings) > 0 { // Convert deprecated setting. - linterCfg = settings.Settings + linterCfg = map[string]map[string]any{ + a.Name: settings.Settings["mnd"], + } } return newMND(a, &settings.MndSettings, linterCfg) diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint/internal/README.md b/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint/internal/README.md index 1643df7a57..e4d48f012b 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint/internal/README.md +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint/internal/README.md @@ -1,7 +1,7 @@ # nolintlint nolintlint is a Go static analysis tool to find ill-formed or insufficiently explained `//nolint` directives for golangci-lint -(or any other linter, using this package) +(or any other linter, using this package) ## Purpose @@ -15,7 +15,7 @@ func hash(data []byte) []byte { } ``` -In the above case, nolint directives are present but the user has no idea why this is being done or which linter +In the above case, nolint directives are present, but the user has no idea why this is being done or which linter is being suppressed (in this case, gosec recommends against use of md5). `nolintlint` can require that the code provide an explanation, which might look as follows: ```Go @@ -26,6 +26,6 @@ func hash(data []byte) []byte { } ``` -`nolintlint` can also identify cases where you may have written `// nolint`. Finally `nolintlint`, can also enforce that you +`nolintlint` can also identify cases where you may have written `// nolint`. Finally, `nolintlint`, can also enforce that you use the machine-readable nolint directive format `//nolint:all` and that you mention what linter is being suppressed, as shown above when we write `//nolint:gosec`. diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/builder_linter.go b/tools/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/builder_linter.go index 7b9d2a559b..a66f2eea09 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/builder_linter.go +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/builder_linter.go @@ -507,6 +507,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) { linter.NewConfig(intrange.New()). WithSince("v1.57.0"). + WithPresets(linter.PresetStyle). WithURL("https://github.com/ckaznocha/intrange"). WithNoopFallback(cfg, linter.IsGoLowerThanGo122()), diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/printers/githubaction.go b/tools/vendor/github.com/golangci/golangci-lint/pkg/printers/githubaction.go index a37c4aeb67..d9cdb1e6e6 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/printers/githubaction.go +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/printers/githubaction.go @@ -14,7 +14,7 @@ type GitHubAction struct { w io.Writer } -// NewGitHubAction output format outputs issues according to GitHub actions. +// NewGitHubAction output format outputs issues according to GitHub Action. // Deprecated func NewGitHubAction(w io.Writer) *GitHubAction { return &GitHubAction{w: w} diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/printers/sarif.go b/tools/vendor/github.com/golangci/golangci-lint/pkg/printers/sarif.go index 378ee008ae..9ccf33ce19 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/printers/sarif.go +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/printers/sarif.go @@ -70,6 +70,7 @@ func NewSarif(w io.Writer) *Sarif { func (p Sarif) Print(issues []result.Issue) error { run := sarifRun{} run.Tool.Driver.Name = "golangci-lint" + run.Results = make([]sarifResult, 0) for i := range issues { issue := issues[i] @@ -88,8 +89,10 @@ func (p Sarif) Print(issues []result.Issue) error { PhysicalLocation: sarifPhysicalLocation{ ArtifactLocation: sarifArtifactLocation{URI: issue.FilePath()}, Region: sarifRegion{ - StartLine: issue.Line(), - StartColumn: issue.Column(), + StartLine: issue.Line(), + // If startColumn is absent, it SHALL default to 1. + // https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/sarif-v2.1.0-errata01-os-complete.html#_Toc141790941 + StartColumn: max(1, issue.Column()), }, }, }, diff --git a/tools/vendor/github.com/golangci/golangci-lint/pkg/result/processors/path_prettifier.go b/tools/vendor/github.com/golangci/golangci-lint/pkg/result/processors/path_prettifier.go index 3c97f06a65..c5c27357c6 100644 --- a/tools/vendor/github.com/golangci/golangci-lint/pkg/result/processors/path_prettifier.go +++ b/tools/vendor/github.com/golangci/golangci-lint/pkg/result/processors/path_prettifier.go @@ -1,7 +1,6 @@ package processors import ( - "fmt" "path/filepath" "github.com/golangci/golangci-lint/pkg/fsutils" @@ -11,16 +10,10 @@ import ( var _ Processor = (*PathPrettifier)(nil) type PathPrettifier struct { - root string } func NewPathPrettifier() *PathPrettifier { - root, err := fsutils.Getwd() - if err != nil { - panic(fmt.Sprintf("Can't get working dir: %s", err)) - } - - return &PathPrettifier{root: root} + return &PathPrettifier{} } func (PathPrettifier) Name() string { diff --git a/tools/vendor/github.com/golangci/misspell/.pre-commit-hooks.yaml b/tools/vendor/github.com/golangci/misspell/.pre-commit-hooks.yaml new file mode 100644 index 0000000000..5319a75ebe --- /dev/null +++ b/tools/vendor/github.com/golangci/misspell/.pre-commit-hooks.yaml @@ -0,0 +1,8 @@ +- id: misspell + name: misspell + description: Correct commonly misspelled English words... quickly + language: golang + entry: misspell + args: + - -w + - -error diff --git a/tools/vendor/github.com/golangci/misspell/README.md b/tools/vendor/github.com/golangci/misspell/README.md index 514727fad0..d2c3e75275 100644 --- a/tools/vendor/github.com/golangci/misspell/README.md +++ b/tools/vendor/github.com/golangci/misspell/README.md @@ -67,6 +67,23 @@ Usage of misspell: -w Overwrite file with corrections (default is just to display) ``` +### Pre-commit hook + +To use misspell with [pre-commit](https://pre-commit.com/), add the following to your `.pre-commit-config.yaml`: + + +```yaml +- repo: https://github.com/golangci/misspell + rev: v0.6.0 + hooks: + - id: misspell + # The hook will run on all files by default. + # To limit to some files only, use pre-commit patterns/types + # files: + # exclude: + # types: +``` + ## FAQ * [Automatic Corrections](#correct) diff --git a/tools/vendor/github.com/golangci/misspell/goreleaser.yml b/tools/vendor/github.com/golangci/misspell/goreleaser.yml index 99781e27a3..2d2be1a759 100644 --- a/tools/vendor/github.com/golangci/misspell/goreleaser.yml +++ b/tools/vendor/github.com/golangci/misspell/goreleaser.yml @@ -15,9 +15,14 @@ builds: - CGO_ENABLED=0 archives: - - name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" - files: - - LICENSE + - format: tar.gz + wrap_in_directory: true + format_overrides: + - goos: windows + format: zip + name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' + files: + - LICENSE checksum: name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt" diff --git a/tools/vendor/github.com/golangci/misspell/install-misspell.sh b/tools/vendor/github.com/golangci/misspell/install-misspell.sh index 51e9b3372a..d6023e117f 100644 --- a/tools/vendor/github.com/golangci/misspell/install-misspell.sh +++ b/tools/vendor/github.com/golangci/misspell/install-misspell.sh @@ -1,39 +1,33 @@ #!/bin/sh set -e -# Code generated by godownloader. DO NOT EDIT. -# usage() { this=$1 cat <] [-d] [] -b sets bindir or installation directory, Defaults to ./bin - [tag] is a tag from + -d turns on debug logging + is a tag from https://github.com/golangci/misspell/releases - If tag is missing, then an attempt to find the latest will be found. - - Consider setting GITHUB_TOKEN to avoid triggering GitHub rate limits. - See the following for more details: - https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ - - Generated by godownloader - https://github.com/goreleaser/godownloader + If tag is missing, then the latest will be used. EOF exit 2 } parse_args() { - #BINDIR is ./bin unless set be ENV - # over-ridden by flag below + # BINDIR is ./bin unless set be ENV + # overridden by flag below BINDIR=${BINDIR:-./bin} - while getopts "b:h?" arg; do + while getopts "b:dh?x" arg; do case "$arg" in b) BINDIR="$OPTARG" ;; + d) log_set_priority 10 ;; h | \?) usage "$0" ;; + x) set -x ;; esac done shift $((OPTIND - 1)) @@ -44,72 +38,66 @@ parse_args() { # network, either nothing will happen or will syntax error # out preventing half-done work execute() { - TMPDIR=$(mktmpdir) - log_debug "downloading tarball ${TARBALL_URL}" - http_download "${TMPDIR}/${TARBALL}" "${TARBALL_URL}" - log_debug "downloading checksum ${CHECKSUM_URL}" - http_download "${TMPDIR}/${CHECKSUM}" "${CHECKSUM_URL}" - hash_sha256_verify "${TMPDIR}/${TARBALL}" "${TMPDIR}/${CHECKSUM}" - - (cd "${TMPDIR}" && untar "${TARBALL}") - install -d "${BINDIR}" - install "${TMPDIR}/${BINARY}" "${BINDIR}/" - log_info "installed as ${BINDIR}/${BINARY}" + tmpdir=$(mktemp -d) + log_debug "downloading files into ${tmpdir}" + http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}" + http_download "${tmpdir}/${CHECKSUM}" "${CHECKSUM_URL}" + hash_sha256_verify "${tmpdir}/${TARBALL}" "${tmpdir}/${CHECKSUM}" + srcdir="${tmpdir}/${NAME}" + rm -rf "${srcdir}" + (cd "${tmpdir}" && untar "${TARBALL}") + test ! -d "${BINDIR}" && install -d "${BINDIR}" + for binexe in $BINARIES; do + if [ "$OS" = "windows" ]; then + binexe="${binexe}.exe" + fi + install "${srcdir}/${binexe}" "${BINDIR}/" + log_info "installed ${BINDIR}/${binexe}" + done + rm -rf "${tmpdir}" } -is_supported_platform() { - platform=$1 - found=1 - case "$platform" in - darwin/amd64) found=0 ;; - linux/amd64) found=0 ;; - windows/amd64) found=0 ;; - darwin/arm64) found=0 ;; - linux/arm64) found=0 ;; - esac - case "$platform" in - darwin/386) found=1 ;; - windows/386) found=1 ;; +get_binaries() { + case "$PLATFORM" in + darwin/amd64) BINARIES="misspell" ;; + darwin/arm64) BINARIES="misspell" ;; + linux/amd64) BINARIES="misspell" ;; + linux/arm64) BINARIES="misspell" ;; + windows/amd64) BINARIES="misspell" ;; + windows/arm64) BINARIES="misspell" ;; + *) + log_crit "platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX}/issues/new" + exit 1 + ;; esac - return $found -} -check_platform() { - if is_supported_platform "$PLATFORM"; then - # optional logging goes here - true - else - log_crit "platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX}/issues/new" - exit 1 - fi } tag_to_version() { if [ -z "${TAG}" ]; then log_info "checking GitHub for latest tag" - TAG=$(github_last_release "$OWNER/$REPO") + else + log_info "checking GitHub for tag '${TAG}'" + fi + REALTAG=$(github_release "$OWNER/$REPO" "${TAG}") && true + if test -z "$REALTAG"; then + log_crit "unable to find '${TAG}' - use 'latest' or see https://github.com/${PREFIX}/releases for details" + exit 1 fi # if version starts with 'v', remove it + TAG="$REALTAG" VERSION=${TAG#v} } adjust_format() { - # change format (tar.gz or zip) based on ARCH + # change format (tar.gz or zip) based on OS + case ${OS} in + windows) FORMAT=zip ;; + esac true } adjust_os() { # adjust archive name based on OS - case ${OS} in - 386) OS=32bit ;; - amd64) OS=amd64 ;; - arm64) OS=64bit ;; - darwin) OS=mac ;; - esac true } adjust_arch() { # adjust archive name based on ARCH - case ${ARCH} in - 386) ARCH=32bit ;; - amd64) ARCH=64bit ;; - darwin) ARCH=mac ;; - esac true } @@ -127,9 +115,6 @@ is_command() { echoerr() { echo "$@" 1>&2 } -log_prefix() { - echo "$0" -} _logp=6 log_set_priority() { _logp="$1" @@ -139,24 +124,45 @@ log_priority() { echo "$_logp" return fi - [ "$1" -ge "$_logp" ] + [ "$1" -le "$_logp" ] +} +log_tag() { + case $1 in + 0) echo "emerg" ;; + 1) echo "alert" ;; + 2) echo "crit" ;; + 3) echo "err" ;; + 4) echo "warning" ;; + 5) echo "notice" ;; + 6) echo "info" ;; + 7) echo "debug" ;; + *) echo "$1" ;; + esac } log_debug() { - log_priority 7 && echoerr "$(log_prefix)" "DEBUG" "$@" + log_priority 7 || return 0 + echoerr "$(log_prefix)" "$(log_tag 7)" "$@" } log_info() { - log_priority 6 && echoerr "$(log_prefix)" "INFO" "$@" + log_priority 6 || return 0 + echoerr "$(log_prefix)" "$(log_tag 6)" "$@" } log_err() { - log_priority 3 && echoerr "$(log_prefix)" "ERR" "$@" + log_priority 3 || return 0 + echoerr "$(log_prefix)" "$(log_tag 3)" "$@" } log_crit() { - log_priority 2 && echoerr "$(log_prefix)" "CRIT" "$@" + log_priority 2 || return 0 + echoerr "$(log_prefix)" "$(log_tag 2)" "$@" } uname_os() { os=$(uname -s | tr '[:upper:]' '[:lower:]') case "$os" in - msys_nt) os="windows" ;; + msys*) os="windows" ;; + mingw*) os="windows" ;; + cygwin*) os="windows" ;; + win*) os="windows" ;; + sunos) [ "$(uname -o)" = "illumos" ] && os=illumos ;; esac echo "$os" } @@ -167,12 +173,14 @@ uname_arch() { x86) arch="386" ;; i686) arch="386" ;; i386) arch="386" ;; + i86pc) arch="amd64" ;; aarch64) arch="arm64" ;; - armv5*) arch="arm5" ;; - armv6*) arch="arm6" ;; - armv7*) arch="arm7" ;; + armv5*) arch="armv5" ;; + armv6*) arch="armv6" ;; + armv7*) arch="armv7" ;; + loongarch64) arch="loong64" ;; esac - echo ${arch} + echo "${arch}" } uname_os_check() { os=$(uname_os) @@ -180,6 +188,7 @@ uname_os_check() { darwin) return 0 ;; dragonfly) return 0 ;; freebsd) return 0 ;; + illumos) return 0;; linux) return 0 ;; android) return 0 ;; nacl) return 0 ;; @@ -189,7 +198,7 @@ uname_os_check() { solaris) return 0 ;; windows) return 0 ;; esac - log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib" + log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value." return 1 } uname_arch_check() { @@ -208,16 +217,18 @@ uname_arch_check() { mips64) return 0 ;; mips64le) return 0 ;; s390x) return 0 ;; + riscv64) return 0 ;; amd64p32) return 0 ;; + loong64) return 0 ;; esac - log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib" + log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value." return 1 } untar() { tarball=$1 case "${tarball}" in - *.tar.gz | *.tgz) tar -xzf "${tarball}" ;; - *.tar) tar -xf "${tarball}" ;; + *.tar.gz | *.tgz) tar --no-same-owner -xzf "${tarball}" ;; + *.tar) tar --no-same-owner -xf "${tarball}" ;; *.zip) unzip "${tarball}" ;; *) log_err "untar unknown archive format for ${tarball}" @@ -225,52 +236,57 @@ untar() { ;; esac } -mktmpdir() { - test -z "$TMPDIR" && TMPDIR="$(mktemp -d)" - mkdir -p "${TMPDIR}" - echo "${TMPDIR}" -} -http_download() { +http_download_curl() { local_file=$1 source_url=$2 header=$3 - headerflag='' - destflag='' - if is_command curl; then - cmd='curl --fail -sSL' - destflag='-o' - headerflag='-H' - elif is_command wget; then - cmd='wget -q' - destflag='-O' - headerflag='--header' + if [ -z "$header" ]; then + code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url") else - log_crit "http_download unable to find wget or curl" + code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url") + fi + if [ "$code" != "200" ]; then + log_debug "http_download_curl received HTTP status $code" return 1 fi + return 0 +} +http_download_wget() { + local_file=$1 + source_url=$2 + header=$3 if [ -z "$header" ]; then - $cmd $destflag "$local_file" "$source_url" + wget -q -O "$local_file" "$source_url" else - $cmd $headerflag "$header" $destflag "$local_file" "$source_url" + wget -q --header "$header" -O "$local_file" "$source_url" fi } -github_api() { - local_file=$1 - source_url=$2 - header="" - case "$source_url" in - https://api.github.com*) - test -z "$GITHUB_TOKEN" || header="Authorization: token $GITHUB_TOKEN" - ;; - esac - http_download "$local_file" "$source_url" "$header" +http_download() { + log_debug "http_download $2" + if is_command curl; then + http_download_curl "$@" + return + elif is_command wget; then + http_download_wget "$@" + return + fi + log_crit "http_download unable to find wget or curl" + return 1 } -github_last_release() { +http_copy() { + tmp=$(mktemp) + http_download "${tmp}" "$1" "$2" || return 1 + body=$(cat "$tmp") + rm -f "${tmp}" + echo "$body" +} +github_release() { owner_repo=$1 version=$2 test -z "$version" && version="latest" giturl="https://github.com/${owner_repo}/releases/${version}" - json=$(http_download "-" "$giturl" "Accept:application/json") + json=$(http_copy "$giturl" "Accept:application/json") + test -z "$json" && return 1 version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//') test -z "$version" && return 1 echo "$version" @@ -319,6 +335,7 @@ End of functions from https://github.com/client9/shlib ------------------------------------------------------------------------ EOF +PROJECT_NAME="misspell" OWNER=golangci REPO="misspell" BINARY=misspell @@ -339,7 +356,7 @@ uname_arch_check "$ARCH" parse_args "$@" -check_platform +get_binaries tag_to_version @@ -357,9 +374,4 @@ TARBALL_URL=${GITHUB_DOWNLOAD}/${TAG}/${TARBALL} CHECKSUM=${BINARY}_${VERSION}_checksums.txt CHECKSUM_URL=${GITHUB_DOWNLOAD}/${TAG}/${CHECKSUM} -# Adjust binary name if windows -if [ "$OS" = "windows" ]; then - BINARY="${BINARY}.exe" -fi - execute diff --git a/tools/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go b/tools/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go index 7490ceff63..791e50fdb9 100644 --- a/tools/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go +++ b/tools/vendor/github.com/polyfloyd/go-errorlint/errorlint/allowed.go @@ -127,13 +127,13 @@ func isAllowedErrAndFunc(err, fun string) bool { return false } -func isAllowedErrorComparison(pass *TypesInfoExt, binExpr *ast.BinaryExpr) bool { +func isAllowedErrorComparison(pass *TypesInfoExt, a, b ast.Expr) bool { var errName string // `.`, e.g. `io.EOF` var callExprs []*ast.CallExpr // Figure out which half of the expression is the returned error and which // half is the presumed error declaration. - for _, expr := range []ast.Expr{binExpr.X, binExpr.Y} { + for _, expr := range []ast.Expr{a, b} { switch t := expr.(type) { case *ast.SelectorExpr: // A selector which we assume refers to a staticaly declared error diff --git a/tools/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go b/tools/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go index 6648d31790..9ac465c650 100644 --- a/tools/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go +++ b/tools/vendor/github.com/polyfloyd/go-errorlint/errorlint/lint.go @@ -172,15 +172,15 @@ func LintErrorComparisons(info *TypesInfoExt) []analysis.Diagnostic { continue } // Comparing errors with nil is okay. - if isNilComparison(binExpr) { + if isNil(binExpr.X) || isNil(binExpr.Y) { continue } // Find comparisons of which one side is a of type error. - if !isErrorComparison(info.TypesInfo, binExpr) { + if !isErrorType(info.TypesInfo, binExpr.X) && !isErrorType(info.TypesInfo, binExpr.Y) { continue } // Some errors that are returned from some functions are exempt. - if isAllowedErrorComparison(info, binExpr) { + if isAllowedErrorComparison(info, binExpr.X, binExpr.Y) { continue } // Comparisons that happen in `func (type) Is(error) bool` are okay. @@ -201,13 +201,29 @@ func LintErrorComparisons(info *TypesInfoExt) []analysis.Diagnostic { continue } // Check whether the switch operates on an error type. - if switchStmt.Tag == nil { + if !isErrorType(info.TypesInfo, switchStmt.Tag) { continue } - tagType := info.TypesInfo.Types[switchStmt.Tag] - if tagType.Type.String() != "error" { + + var problematicCaseClause *ast.CaseClause + outer: + for _, stmt := range switchStmt.Body.List { + caseClause := stmt.(*ast.CaseClause) + for _, caseExpr := range caseClause.List { + if isNil(caseExpr) { + continue + } + // Some errors that are returned from some functions are exempt. + if !isAllowedErrorComparison(info, switchStmt.Tag, caseExpr) { + problematicCaseClause = caseClause + break outer + } + } + } + if problematicCaseClause == nil { continue } + // Comparisons that happen in `func (type) Is(error) bool` are okay. if isNodeInErrorIsFunc(info, switchStmt) { continue } @@ -215,29 +231,22 @@ func LintErrorComparisons(info *TypesInfoExt) []analysis.Diagnostic { if switchComparesNonNil(switchStmt) { lints = append(lints, analysis.Diagnostic{ Message: "switch on an error will fail on wrapped errors. Use errors.Is to check for specific errors", - Pos: switchStmt.Pos(), + Pos: problematicCaseClause.Pos(), }) } - } return lints } -func isNilComparison(binExpr *ast.BinaryExpr) bool { - if ident, ok := binExpr.X.(*ast.Ident); ok && ident.Name == "nil" { - return true - } - if ident, ok := binExpr.Y.(*ast.Ident); ok && ident.Name == "nil" { - return true - } - return false +func isNil(ex ast.Expr) bool { + ident, ok := ex.(*ast.Ident) + return ok && ident.Name == "nil" } -func isErrorComparison(info *types.Info, binExpr *ast.BinaryExpr) bool { - tx := info.Types[binExpr.X] - ty := info.Types[binExpr.Y] - return tx.Type.String() == "error" || ty.Type.String() == "error" +func isErrorType(info *types.Info, ex ast.Expr) bool { + t := info.Types[ex].Type + return t != nil && t.String() == "error" } func isNodeInErrorIsFunc(info *TypesInfoExt, node ast.Node) bool { diff --git a/tools/vendor/github.com/sashamelentyev/usestdlibvars/pkg/analyzer/analyzer.go b/tools/vendor/github.com/sashamelentyev/usestdlibvars/pkg/analyzer/analyzer.go index 4d6ab3ccab..581bed2d4e 100644 --- a/tools/vendor/github.com/sashamelentyev/usestdlibvars/pkg/analyzer/analyzer.go +++ b/tools/vendor/github.com/sashamelentyev/usestdlibvars/pkg/analyzer/analyzer.go @@ -63,9 +63,8 @@ func run(pass *analysis.Pass) (interface{}, error) { (*ast.CallExpr)(nil), (*ast.BasicLit)(nil), (*ast.CompositeLit)(nil), - (*ast.IfStmt)(nil), + (*ast.BinaryExpr)(nil), (*ast.SwitchStmt)(nil), - (*ast.ForStmt)(nil), } insp.Preorder(types, func(node ast.Node) { @@ -116,54 +115,30 @@ func run(pass *analysis.Pass) (interface{}, error) { typeElts(pass, x, typ, n.Elts) - case *ast.IfStmt: - cond, ok := n.Cond.(*ast.BinaryExpr) - if !ok { - return - } - - switch cond.Op { + case *ast.BinaryExpr: + switch n.Op { case token.LSS, token.GTR, token.LEQ, token.GEQ: return } - x, ok := cond.X.(*ast.SelectorExpr) + x, ok := n.X.(*ast.SelectorExpr) if !ok { return } - y, ok := cond.Y.(*ast.BasicLit) + y, ok := n.Y.(*ast.BasicLit) if !ok { return } - ifElseStmt(pass, x, y) + binaryExpr(pass, x, y) case *ast.SwitchStmt: x, ok := n.Tag.(*ast.SelectorExpr) if ok { switchStmt(pass, x, n.Body.List) - } else { - switchStmtAsIfElseStmt(pass, n.Body.List) - } - - case *ast.ForStmt: - cond, ok := n.Cond.(*ast.BinaryExpr) - if !ok { - return - } - - x, ok := cond.X.(*ast.SelectorExpr) - if !ok { - return - } - - y, ok := cond.Y.(*ast.BasicLit) - if !ok { - return } - ifElseStmt(pass, x, y) } }) @@ -318,8 +293,11 @@ func typeElts(pass *analysis.Pass, x *ast.Ident, typ *ast.SelectorExpr, elts []a } } -// ifElseStmt checks X and Y in if-else-statement. -func ifElseStmt(pass *analysis.Pass, x *ast.SelectorExpr, y *ast.BasicLit) { +// binaryExpr checks X and Y in binary expressions, including: +// - if-else-statement +// - for loops conditions +// - switch cases without a tag expression +func binaryExpr(pass *analysis.Pass, x *ast.SelectorExpr, y *ast.BasicLit) { switch x.Sel.Name { case "StatusCode": if !lookupFlag(pass, HTTPStatusCodeFlag) { @@ -376,34 +354,6 @@ func switchStmt(pass *analysis.Pass, x *ast.SelectorExpr, cases []ast.Stmt) { } } -func switchStmtAsIfElseStmt(pass *analysis.Pass, cases []ast.Stmt) { - for _, c := range cases { - caseClause, ok := c.(*ast.CaseClause) - if !ok { - continue - } - - for _, expr := range caseClause.List { - binaryExpr, ok := expr.(*ast.BinaryExpr) - if !ok { - continue - } - - x, ok := binaryExpr.X.(*ast.SelectorExpr) - if !ok { - continue - } - - y, ok := binaryExpr.Y.(*ast.BasicLit) - if !ok { - continue - } - - ifElseStmt(pass, x, y) - } - } -} - func lookupFlag(pass *analysis.Pass, name string) bool { return pass.Analyzer.Flags.Lookup(name).Value.(flag.Getter).Get().(bool) } diff --git a/tools/vendor/go-simpler.org/sloglint/sloglint.go b/tools/vendor/go-simpler.org/sloglint/sloglint.go index 525bee3b00..ee6e5e8c0a 100644 --- a/tools/vendor/go-simpler.org/sloglint/sloglint.go +++ b/tools/vendor/go-simpler.org/sloglint/sloglint.go @@ -223,7 +223,8 @@ func visit(pass *analysis.Pass, opts *Options, node ast.Node, stack []ast.Node) } msgPos := funcInfo.argsPos - 1 - if opts.StaticMsg && !isStaticMsg(call.Args[msgPos]) { + // NOTE: "With" functions have no message argument and must be skipped. + if opts.StaticMsg && msgPos >= 0 && !isStaticMsg(call.Args[msgPos]) { pass.Reportf(call.Pos(), "message should be a string literal or a constant") } diff --git a/tools/vendor/modules.txt b/tools/vendor/modules.txt index 5680484b60..0fae87fc0f 100644 --- a/tools/vendor/modules.txt +++ b/tools/vendor/modules.txt @@ -16,7 +16,7 @@ github.com/Antonboom/errname/pkg/analyzer # github.com/Antonboom/nilnil v0.1.9 ## explicit; go 1.20 github.com/Antonboom/nilnil/pkg/analyzer -# github.com/Antonboom/testifylint v1.3.0 +# github.com/Antonboom/testifylint v1.3.1 ## explicit; go 1.20 github.com/Antonboom/testifylint/analyzer github.com/Antonboom/testifylint/internal/analysisutil @@ -190,9 +190,10 @@ github.com/go-toolsmith/strparse # github.com/go-toolsmith/typep v1.1.0 ## explicit; go 1.16 github.com/go-toolsmith/typep -# github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 +# github.com/go-viper/mapstructure/v2 v2.0.0 ## explicit; go 1.18 github.com/go-viper/mapstructure/v2 +github.com/go-viper/mapstructure/v2/internal/errors # github.com/go-xmlfmt/xmlfmt v1.1.2 ## explicit github.com/go-xmlfmt/xmlfmt @@ -229,7 +230,7 @@ github.com/golangci/dupl/syntax/golang github.com/golangci/gofmt/gofmt github.com/golangci/gofmt/gofmt/internal/diff github.com/golangci/gofmt/goimports -# github.com/golangci/golangci-lint v1.59.0 +# github.com/golangci/golangci-lint v1.59.1 ## explicit; go 1.21 github.com/golangci/golangci-lint/cmd/golangci-lint github.com/golangci/golangci-lint/internal/cache @@ -365,7 +366,7 @@ github.com/golangci/golangci-lint/pkg/report github.com/golangci/golangci-lint/pkg/result github.com/golangci/golangci-lint/pkg/result/processors github.com/golangci/golangci-lint/pkg/timeutils -# github.com/golangci/misspell v0.5.1 +# github.com/golangci/misspell v0.6.0 ## explicit; go 1.21 github.com/golangci/misspell # github.com/golangci/modinfo v0.3.4 @@ -564,7 +565,7 @@ github.com/pelletier/go-toml/v2/unstable # github.com/pmezard/go-difflib v1.0.0 ## explicit github.com/pmezard/go-difflib/difflib -# github.com/polyfloyd/go-errorlint v1.5.1 +# github.com/polyfloyd/go-errorlint v1.5.2 ## explicit; go 1.20 github.com/polyfloyd/go-errorlint/errorlint # github.com/prometheus/client_golang v1.12.1 @@ -636,7 +637,7 @@ github.com/santhosh-tekuri/jsonschema/v5/httploader # github.com/sashamelentyev/interfacebloat v1.1.0 ## explicit; go 1.18 github.com/sashamelentyev/interfacebloat/pkg/analyzer -# github.com/sashamelentyev/usestdlibvars v1.25.0 +# github.com/sashamelentyev/usestdlibvars v1.26.0 ## explicit; go 1.20 github.com/sashamelentyev/usestdlibvars/pkg/analyzer github.com/sashamelentyev/usestdlibvars/pkg/analyzer/internal/mapping @@ -769,7 +770,7 @@ gitlab.com/bosi/decorder # go-simpler.org/musttag v0.12.2 ## explicit; go 1.20 go-simpler.org/musttag -# go-simpler.org/sloglint v0.7.0 +# go-simpler.org/sloglint v0.7.1 ## explicit; go 1.21 go-simpler.org/sloglint # go.uber.org/atomic v1.7.0 @@ -983,6 +984,6 @@ mvdan.cc/gofumpt/internal/govendor/go/doc/comment mvdan.cc/gofumpt/internal/govendor/go/format mvdan.cc/gofumpt/internal/govendor/go/printer mvdan.cc/gofumpt/internal/version -# mvdan.cc/unparam v0.0.0-20240427195214-063aff900ca1 -## explicit; go 1.20 +# mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f +## explicit; go 1.21 mvdan.cc/unparam/check diff --git a/tools/vendor/mvdan.cc/unparam/check/check.go b/tools/vendor/mvdan.cc/unparam/check/check.go index b1704e454c..2bda013057 100644 --- a/tools/vendor/mvdan.cc/unparam/check/check.go +++ b/tools/vendor/mvdan.cc/unparam/check/check.go @@ -908,15 +908,20 @@ func recvPrefix(recv *ast.FieldList) string { } expr = star.X } + + return identName(expr) +} + +func identName(expr ast.Expr) string { switch expr := expr.(type) { case *ast.Ident: return expr.Name + "." case *ast.IndexExpr: - return expr.X.(*ast.Ident).Name + "." + return identName(expr.X) case *ast.ParenExpr: - return expr.X.(*ast.Ident).Name + "." + return identName(expr.X) case *ast.IndexListExpr: - return expr.X.(*ast.Ident).Name + "." + return identName(expr.X) default: panic(fmt.Sprintf("unexpected receiver AST node: %T", expr)) }