diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml
index 0403d8f461c4..d8c1b8d7f855 100644
--- a/.github/workflows/post-release.yml
+++ b/.github/workflows/post-release.yml
@@ -4,6 +4,13 @@ on:
types:
- published
+env:
+ # https://github.com/actions/setup-go#supported-version-syntax
+ # ex:
+ # - 1.18beta1 -> 1.18.0-beta.1
+ # - 1.18rc1 -> 1.18.0-rc.1
+ GO_VERSION: '1.23'
+
jobs:
update-docs:
name: "Update readme"
@@ -11,11 +18,6 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GOLANGCI_LINT_TOKEN }}
- # https://github.com/actions/setup-go#supported-version-syntax
- # ex:
- # - 1.18beta1 -> 1.18.0-beta.1
- # - 1.18rc1 -> 1.18.0-rc.1
- GO_VERSION: '1.23'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
diff --git a/.golangci.next.reference.yml b/.golangci.next.reference.yml
index c15f96d84d54..e08464bdd6b8 100644
--- a/.golangci.next.reference.yml
+++ b/.golangci.next.reference.yml
@@ -853,6 +853,7 @@ linters-settings:
- G112 # Potential slowloris attack
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
- G114 # Use of net/http serve function that has no support for setting timeouts
+ - G115 # Potential integer overflow when converting between integer types
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G203 # Use of unescaped data in HTML templates
@@ -864,15 +865,19 @@ linters-settings:
- G305 # File traversal when extracting zip/tar archive
- G306 # Poor file permissions used when writing to a new file
- G307 # Poor file permissions used when creating a file with os.Create
- - G401 # Detect the usage of DES, RC4, MD5 or SHA1
+ - G401 # Detect the usage of MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
+ - G405 # Detect the usage of DES or RC4
+ - G406 # Detect the usage of MD4 or RIPEMD160
- G501 # Import blocklist: crypto/md5
- G502 # Import blocklist: crypto/des
- G503 # Import blocklist: crypto/rc4
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
+ - G506 # Import blocklist: golang.org/x/crypto/md4
+ - G507 #Import blocklist: golang.org/x/crypto/ripemd160
- G601 # Implicit memory aliasing of items from a range statement
- G602 # Slice access out of bounds
@@ -893,6 +898,7 @@ linters-settings:
- G112 # Potential slowloris attack
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
- G114 # Use of net/http serve function that has no support for setting timeouts
+ - G115 # Potential integer overflow when converting between integer types
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G203 # Use of unescaped data in HTML templates
@@ -904,15 +910,19 @@ linters-settings:
- G305 # File traversal when extracting zip/tar archive
- G306 # Poor file permissions used when writing to a new file
- G307 # Poor file permissions used when creating a file with os.Create
- - G401 # Detect the usage of DES, RC4, MD5 or SHA1
+ - G401 # Detect the usage of MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
+ - G405 # Detect the usage of DES or RC4
+ - G406 # Detect the usage of MD4 or RIPEMD160
- G501 # Import blocklist: crypto/md5
- G502 # Import blocklist: crypto/des
- G503 # Import blocklist: crypto/rc4
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
+ - G506 # Import blocklist: golang.org/x/crypto/md4
+ - G507 #Import blocklist: golang.org/x/crypto/ripemd160
- G601 # Implicit memory aliasing of items from a range statement
- G602 # Slice access out of bounds
diff --git a/.golangci.reference.yml b/.golangci.reference.yml
index 45b5376d70ee..2d4c9e10e009 100644
--- a/.golangci.reference.yml
+++ b/.golangci.reference.yml
@@ -874,7 +874,6 @@ linters-settings:
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
- G601 # Implicit memory aliasing of items from a range statement
- - G602 # Slice access out of bounds
# To specify a set of rules to explicitly exclude.
# Available rules: https://github.com/securego/gosec#available-rules
@@ -914,7 +913,6 @@ linters-settings:
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
- G601 # Implicit memory aliasing of items from a range statement
- - G602 # Slice access out of bounds
# Exclude generated files
# Default: false
@@ -1612,6 +1610,12 @@ linters-settings:
arguments:
- mypragma
- otherpragma
+ # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#comments-density
+ - name: comments-density
+ severity: warning
+ disabled: false
+ exclude: [""]
+ arguments: [ 15 ]
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#confusing-naming
- name: confusing-naming
severity: warning
@@ -2201,13 +2205,16 @@ linters-settings:
- error-nil
- expected-actual
- float-compare
+ - formatter
- go-require
- len
- negative-positive
- nil-compare
- require-error
+ - suite-broken-parallel
- suite-dont-use-pkg
- suite-extra-assert-call
+ - suite-subtest-run
- suite-thelper
- useless-assert
@@ -2217,7 +2224,8 @@ linters-settings:
# Enable checkers by name
# (in addition to default
# blank-import, bool-compare, compares, empty, error-is-as, error-nil, expected-actual, go-require, float-compare,
- # len, negative-positive, nil-compare, require-error, suite-dont-use-pkg, suite-extra-assert-call, useless-assert
+ # formatter, len, negative-positive, nil-compare, require-error, suite-broken-parallel, suite-dont-use-pkg,
+ # suite-extra-assert-call, suite-subtest-run, useless-assert
# ).
enable:
- blank-import
@@ -2228,13 +2236,16 @@ linters-settings:
- error-nil
- expected-actual
- float-compare
+ - formatter
- go-require
- len
- negative-positive
- nil-compare
- require-error
+ - suite-broken-parallel
- suite-dont-use-pkg
- suite-extra-assert-call
+ - suite-subtest-run
- suite-thelper
- useless-assert
@@ -2246,6 +2257,13 @@ linters-settings:
# Regexp for expected variable name.
# Default: (^(exp(ected)?|want(ed)?)([A-Z]\w*)?$)|(^(\w*[a-z])?(Exp(ected)?|Want(ed)?)$)
pattern: ^expected
+ formatter:
+ # To enable go vet's printf checks.
+ # Default: true
+ check-format-string: false
+ # To require f-assertions if format string is used.
+ # Default: false
+ require-f-funcs: true
go-require:
# To ignore HTTP handlers (like http.HandlerFunc).
# Default: false
@@ -2369,9 +2387,6 @@ linters-settings:
# Treat IncDec statement (e.g. `i++` or `i--`) as both read and write operation instead of just write.
# Default: false
post-statements-are-reads: true
- # Mark all exported identifiers as used.
- # Default: true
- exported-is-used: false
# Mark all exported fields as used.
# default: true
exported-fields-are-used: false
diff --git a/.golangci.yml b/.golangci.yml
index 7c21a62424cb..7b12bf801e99 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -106,15 +106,16 @@ linters:
disable-all: true
enable:
- bodyclose
+ - copyloopvar
- depguard
- dogsled
- dupl
- errcheck
- errorlint
- - exportloopref
- funlen
- gocheckcompilerdirectives
- gochecknoinits
+ - gochecknoinits
- goconst
- gocritic
- gocyclo
@@ -126,6 +127,7 @@ linters:
- gosec
- gosimple
- govet
+ - intrange
- ineffassign
- lll
- misspell
@@ -202,6 +204,21 @@ issues:
linters: [gocritic]
text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)"
+ # Related to file sizes.
+ - path: pkg/goanalysis/runner_loadingpackage.go
+ linters: [gosec]
+ text: "G115: integer overflow conversion uintptr -> int"
+
+ # Related to PID.
+ - path: test/bench/bench_test.go
+ linters: [gosec]
+ text: "G115: integer overflow conversion int -> int32"
+
+ # Related to the result of computation but divided multiple times by 1024.
+ - path: test/bench/bench_test.go
+ linters: [gosec]
+ text: "G115: integer overflow conversion uint64 -> int"
+
exclude-dirs:
- test/testdata_etc # test files
- internal/cache # extracted from Go code
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cb6575f99037..a606f7395679 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,9 +1,43 @@
Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint) and on [Twitter](https://twitter.com/golangci).
+### v1.60.1
+
+1. Updated linters
+ * `errorlint`: from 1.5.2 to 1.6.0
+ * `exhaustruct`: from 3.2.0 to 3.3.0 (recognize custom error values in return)
+ * `fatcontext`: from 0.2.2 to 0.4.0 (fix false positives for context stored in structs)
+ * `gocognit`: from 1.1.2 to 1.1.3
+ * `gomodguard`: from 1.3.2 to 1.3.3
+ * `govet` (`printf`): report non-constant format, no args
+ * `lll`: advertise max line length instead of just reporting failure
+ * `revive`: from 1.3.7 to 1.3.9 (new rule: `comments-density`)
+ * `sloglint`: from 0.7.1 to 0.7.2
+ * `spancheck`: from 0.6.1 to 0.6.2
+ * `staticcheck`: from 0.4.7 to 0.5.0
+ * `tenv`: from 1.7.1 to 1.10.0 (remove reports on fuzzing)
+ * `testifylint`: from 1.3.1 to 1.4.3 (new options: `formatter`, `suite-broken-parallel`, `suite-subtest-run`)
+ * `tparallel`: from 0.3.1 to 0.3.2
+ * `usestdlibvars`: from 1.26.0 to 1.27.0 (fix false-positive with number used inside a mathematical operations)
+ * `wsl`: from 4.2.1 to 4.4.1
+ * ️⚠️ `unused`: remove `exported-is-used` option
+2. Fixes
+ * SARIF: sanitize level property
+ * ️⚠️ `typecheck` issues should never be ignored
+3. Documentation
+ * Add link on linter without configuration
+ * Remove 'trusted by' page
+ * `wsl` update documentation of the configuration
+4. misc.
+ * 🎉 go1.23 support
+
+### v1.60.0
+
+Cancelled due to a CI problem.
+
### v1.59.1
1. Updated linters
- * `go-errorlint`: from 1.5.1 to 1.5.2
+ * `errorlint`: from 1.5.1 to 1.5.2
* `gomnd`: deprecated configuration compatibility
* `intrange`: add `style` preset
* `misspell`: from 0.5.1 to 0.6.0
@@ -15,7 +49,7 @@ Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint)
* SARIF: init empty result slice
* SARIF: issue column >= 1
3. Documentation
- * update `revive` configuration
+ * `revive`: update documentation of the configuration
### v1.59.0
diff --git a/README.md b/README.md
index fb23aef47cfb..475574e8032a 100644
--- a/README.md
+++ b/README.md
@@ -83,13 +83,13 @@ The Core Team has the following responsibilities:
-And 489 more our team members
+And 498 more our team members
diff --git a/assets/github-action-config.json b/assets/github-action-config.json
index ae36bba77177..157d52ceaf0d 100644
--- a/assets/github-action-config.json
+++ b/assets/github-action-config.json
@@ -1,8 +1,8 @@
{
"MinorVersionToConfig": {
"latest": {
- "TargetVersion": "v1.59.1",
- "AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.59.1/golangci-lint-1.59.1-linux-amd64.tar.gz"
+ "TargetVersion": "v1.60.1",
+ "AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.60.1/golangci-lint-1.60.1-linux-amd64.tar.gz"
},
"v1.10": {
"Error": "golangci-lint version 'v1.10' isn't supported: we support only v1.14.0 and later versions"
@@ -212,6 +212,10 @@
"v1.6": {
"Error": "golangci-lint version 'v1.6' isn't supported: we support only v1.14.0 and later versions"
},
+ "v1.60": {
+ "TargetVersion": "v1.60.1",
+ "AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.60.1/golangci-lint-1.60.1-linux-amd64.tar.gz"
+ },
"v1.7": {
"Error": "golangci-lint version 'v1.7' isn't supported: we support only v1.14.0 and later versions"
},
diff --git a/assets/linters-info.json b/assets/linters-info.json
index c61794cd1b11..20bc824e1131 100644
--- a/assets/linters-info.json
+++ b/assets/linters-info.json
@@ -1168,7 +1168,7 @@
"desc": "tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17",
"loadMode": 575,
"inPresets": [
- "style"
+ "test"
],
"originalURL": "https://github.com/sivchari/tenv",
"internal": false,
@@ -1218,7 +1218,7 @@
"desc": "thelper detects tests helpers which is not start with t.Helper() method.",
"loadMode": 575,
"inPresets": [
- "style"
+ "test"
],
"originalURL": "https://github.com/kulti/thelper",
"internal": false,
diff --git a/go.mod b/go.mod
index 24b93c456afe..adc5da1cfd9c 100644
--- a/go.mod
+++ b/go.mod
@@ -43,7 +43,7 @@ require (
github.com/go-xmlfmt/xmlfmt v1.1.2
github.com/gofrs/flock v0.12.1
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
- github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e
+ github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9
github.com/golangci/misspell v0.6.0
github.com/golangci/modinfo v0.3.4
github.com/golangci/plugin-module-register v0.1.1
@@ -92,7 +92,7 @@ require (
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/sashamelentyev/interfacebloat v1.1.0
github.com/sashamelentyev/usestdlibvars v1.27.0
- github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9
+ github.com/securego/gosec/v2 v2.20.1-0.20240820084340-81cda2f91fbe
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
github.com/shirou/gopsutil/v3 v3.24.5
github.com/sirupsen/logrus v1.9.3
@@ -110,7 +110,7 @@ require (
github.com/tetafro/godot v1.4.16
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966
github.com/timonwong/loggercheck v0.9.4
- github.com/tomarrell/wrapcheck/v2 v2.8.3
+ github.com/tomarrell/wrapcheck/v2 v2.9.0
github.com/tommy-muehle/go-mnd/v2 v2.5.1
github.com/ultraware/funlen v0.1.0
github.com/ultraware/whitespace v0.1.1
@@ -124,11 +124,11 @@ require (
go-simpler.org/musttag v0.12.2
go-simpler.org/sloglint v0.7.2
go.uber.org/automaxprocs v1.5.3
- golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc
+ golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/tools v0.24.0
gopkg.in/yaml.v3 v3.0.1
- honnef.co/go/tools v0.5.0
- mvdan.cc/gofumpt v0.6.0
+ honnef.co/go/tools v0.5.1
+ mvdan.cc/gofumpt v0.7.0
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f
)
@@ -192,8 +192,8 @@ require (
golang.org/x/mod v0.20.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
- golang.org/x/text v0.15.0 // indirect
- google.golang.org/protobuf v1.33.0 // indirect
+ golang.org/x/text v0.17.0 // indirect
+ google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
diff --git a/go.sum b/go.sum
index 670f3ffa0a76..0d4fc6b658b4 100644
--- a/go.sum
+++ b/go.sum
@@ -141,8 +141,8 @@ github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/firefart/nonamedreturns v1.0.5 h1:tM+Me2ZaXs8tfdDw3X6DOX++wMCOqzYUho6tUTYIdRA=
github.com/firefart/nonamedreturns v1.0.5/go.mod h1:gHJjDqhGM4WyPt639SOZs+G89Ko7QKH5R5BhnO6xJhw=
-github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
-github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
+github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
+github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo=
@@ -160,10 +160,12 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
-github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
-github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
+github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
+github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
+github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI=
+github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
@@ -226,8 +228,8 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM=
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/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/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=
@@ -264,8 +266,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
-github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg=
-github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
+github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k=
+github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
@@ -397,10 +399,10 @@ github.com/nunnatsa/ginkgolinter v0.16.2 h1:8iLqHIZvN4fTLDC0Ke9tbSZVcyVHoBs0HIbn
github.com/nunnatsa/ginkgolinter v0.16.2/go.mod h1:4tWRinDN1FeJgU+iJANW/kz7xKN5nYRAOfJDQUS9dOQ=
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.17.3 h1:oJcvKpIb7/8uLpDDtnQuf18xVnwKp8DTD7DQ6gTd/MU=
-github.com/onsi/ginkgo/v2 v2.17.3/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc=
-github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
-github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
+github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw=
+github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI=
+github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
+github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
@@ -472,8 +474,8 @@ github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tM
github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ=
github.com/sashamelentyev/usestdlibvars v1.27.0 h1:t/3jZpSXtRPRf2xr0m63i32ZrusyurIGT9E5wAvXQnI=
github.com/sashamelentyev/usestdlibvars v1.27.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/securego/gosec/v2 v2.20.1-0.20240820084340-81cda2f91fbe h1:exdneYmXwZ4+VaIWv9mQ47uIHkTQSN50DYdCjXJ1cdQ=
+github.com/securego/gosec/v2 v2.20.1-0.20240820084340-81cda2f91fbe/go.mod h1:iyeMMRw8QEmueUSZ2VqmkQMiDyDcobfPnG00CV/NWdE=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU=
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs=
github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI=
@@ -547,8 +549,8 @@ github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFA
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
-github.com/tomarrell/wrapcheck/v2 v2.8.3 h1:5ov+Cbhlgi7s/a42BprYoxsr73CbdMUTzE3bRDFASUs=
-github.com/tomarrell/wrapcheck/v2 v2.8.3/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo=
+github.com/tomarrell/wrapcheck/v2 v2.9.0 h1:801U2YCAjLhdN8zhZ/7tdjB3EnAoRlJHt/s+9hijLQ4=
+github.com/tomarrell/wrapcheck/v2 v2.9.0/go.mod h1:g9vNIyhb5/9TQgumxQyOEqDHsmGYcGsVMOx/xGkqdMo=
github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw=
github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw=
github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI=
@@ -619,8 +621,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
-golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM=
-golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
+golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
+golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
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-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8=
@@ -791,8 +793,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
-golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
-golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
+golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -937,8 +939,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
-google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
+google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
+google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -965,10 +967,10 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
-honnef.co/go/tools v0.5.0 h1:29uoiIormS3Z6R+t56STz/oI4v+mB51TSmEOdJPgRnE=
-honnef.co/go/tools v0.5.0/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs=
-mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=
-mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA=
+honnef.co/go/tools v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I=
+honnef.co/go/tools v0.5.1/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs=
+mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
+mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo=
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=
diff --git a/jsonschema/golangci.jsonschema.json b/jsonschema/golangci.jsonschema.json
index 66b2cc742a6d..510740d61660 100644
--- a/jsonschema/golangci.jsonschema.json
+++ b/jsonschema/golangci.jsonschema.json
@@ -157,8 +157,7 @@
"G503",
"G504",
"G505",
- "G601",
- "G602"
+ "G601"
]
},
"govet-analyzers": {
@@ -217,6 +216,7 @@
"call-to-gc",
"cognitive-complexity",
"comment-spacings",
+ "comments-density",
"confusing-naming",
"confusing-results",
"constant-logical-expr",
@@ -2886,13 +2886,16 @@
"error-nil",
"expected-actual",
"float-compare",
+ "formatter",
"go-require",
"len",
"negative-positive",
"nil-compare",
"require-error",
+ "suite-broken-parallel",
"suite-dont-use-pkg",
"suite-extra-assert-call",
+ "suite-subtest-run",
"suite-thelper",
"useless-assert"
]
@@ -2906,13 +2909,16 @@
"error-nil",
"expected-actual",
"float-compare",
+ "float-compare",
"go-require",
"len",
"negative-positive",
"nil-compare",
"require-error",
+ "suite-broken-parallel",
"suite-dont-use-pkg",
"suite-extra-assert-call",
+ "suite-subtest-run",
"useless-assert"
]
},
@@ -2929,13 +2935,16 @@
"error-nil",
"expected-actual",
"float-compare",
+ "formatter",
"go-require",
"len",
"negative-positive",
"nil-compare",
"require-error",
+ "suite-broken-parallel",
"suite-dont-use-pkg",
"suite-extra-assert-call",
+ "suite-subtest-run",
"suite-thelper",
"useless-assert"
],
@@ -2966,6 +2975,22 @@
}
}
},
+ "formatter": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "check-format-string": {
+ "description": "To enable go vet's printf checks.",
+ "type": "boolean",
+ "default": true
+ },
+ "require-f-funcs": {
+ "description": "To require f-assertions if format string is used.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
"go-require": {
"type": "object",
"additionalProperties": false,
@@ -3207,11 +3232,6 @@
"type": "boolean",
"default": false
},
- "exported-is-used": {
- "description": "",
- "type": "boolean",
- "default": true
- },
"exported-fields-are-used": {
"description": "",
"type": "boolean",
diff --git a/jsonschema/golangci.next.jsonschema.json b/jsonschema/golangci.next.jsonschema.json
index 16c7f557e940..f8233a77759d 100644
--- a/jsonschema/golangci.next.jsonschema.json
+++ b/jsonschema/golangci.next.jsonschema.json
@@ -137,6 +137,7 @@
"G112",
"G113",
"G114",
+ "G115",
"G201",
"G202",
"G203",
@@ -152,11 +153,15 @@
"G402",
"G403",
"G404",
+ "G405",
+ "G406",
"G501",
"G502",
"G503",
"G504",
"G505",
+ "G506",
+ "G507",
"G601",
"G602"
]
diff --git a/jsonschema/golangci.v1.59.jsonschema.json b/jsonschema/golangci.v1.59.jsonschema.json
new file mode 100644
index 000000000000..66b2cc742a6d
--- /dev/null
+++ b/jsonschema/golangci.v1.59.jsonschema.json
@@ -0,0 +1,3739 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "https://json.schemastore.org/golangci-lint.json",
+ "definitions": {
+ "gocritic-checks": {
+ "enum": [
+ "appendAssign",
+ "appendCombine",
+ "argOrder",
+ "assignOp",
+ "badCall",
+ "badCond",
+ "badLock",
+ "badRegexp",
+ "badSorting",
+ "boolExprSimplify",
+ "builtinShadow",
+ "builtinShadowDecl",
+ "captLocal",
+ "caseOrder",
+ "codegenComment",
+ "commentedOutCode",
+ "commentedOutImport",
+ "commentFormatting",
+ "defaultCaseOrder",
+ "deferUnlambda",
+ "deferInLoop",
+ "deprecatedComment",
+ "docStub",
+ "dupArg",
+ "dupBranchBody",
+ "dupCase",
+ "dupImport",
+ "dupSubExpr",
+ "dynamicFmtString",
+ "elseif",
+ "emptyDecl",
+ "emptyFallthrough",
+ "emptyStringTest",
+ "equalFold",
+ "evalOrder",
+ "exitAfterDefer",
+ "exposedSyncMutex",
+ "externalErrorReassign",
+ "filepathJoin",
+ "flagDeref",
+ "flagName",
+ "hexLiteral",
+ "httpNoBody",
+ "hugeParam",
+ "ifElseChain",
+ "importShadow",
+ "indexAlloc",
+ "initClause",
+ "ioutilDeprecated",
+ "mapKey",
+ "methodExprCall",
+ "nestingReduce",
+ "newDeref",
+ "nilValReturn",
+ "octalLiteral",
+ "offBy1",
+ "paramTypeCombine",
+ "preferDecodeRune",
+ "preferFilepathJoin",
+ "preferFprint",
+ "preferStringWriter",
+ "preferWriteByte",
+ "ptrToRefParam",
+ "rangeExprCopy",
+ "rangeValCopy",
+ "redundantSprint",
+ "regexpMust",
+ "regexpPattern",
+ "regexpSimplify",
+ "returnAfterHttpError",
+ "ruleguard",
+ "singleCaseSwitch",
+ "sliceClear",
+ "sloppyLen",
+ "sloppyReassign",
+ "sloppyTypeAssert",
+ "sortSlice",
+ "sprintfQuotedString",
+ "sqlQuery",
+ "stringConcatSimplify",
+ "stringsCompare",
+ "stringXbytes",
+ "suspiciousSorting",
+ "switchTrue",
+ "syncMapLoadAndDelete",
+ "timeCmpSimplify",
+ "timeExprSimplify",
+ "tooManyResultsChecker",
+ "truncateCmp",
+ "typeAssertChain",
+ "typeDefFirst",
+ "typeSwitchVar",
+ "typeUnparen",
+ "uncheckedInlineErr",
+ "underef",
+ "unlabelStmt",
+ "unlambda",
+ "unnamedResult",
+ "unnecessaryBlock",
+ "unnecessaryDefer",
+ "unslice",
+ "valSwap",
+ "weakCond",
+ "whyNoLint",
+ "wrapperFunc",
+ "yodaStyleExpr"
+ ]
+ },
+ "gocritic-tags": {
+ "enum": [
+ "diagnostic",
+ "style",
+ "performance",
+ "experimental",
+ "opinionated",
+ "security"
+ ]
+ },
+ "gosec-rules": {
+ "enum": [
+ "G101",
+ "G102",
+ "G103",
+ "G104",
+ "G106",
+ "G107",
+ "G108",
+ "G109",
+ "G110",
+ "G111",
+ "G112",
+ "G113",
+ "G114",
+ "G201",
+ "G202",
+ "G203",
+ "G204",
+ "G301",
+ "G302",
+ "G303",
+ "G304",
+ "G305",
+ "G306",
+ "G307",
+ "G401",
+ "G402",
+ "G403",
+ "G404",
+ "G501",
+ "G502",
+ "G503",
+ "G504",
+ "G505",
+ "G601",
+ "G602"
+ ]
+ },
+ "govet-analyzers": {
+ "enum": [
+ "appends",
+ "asmdecl",
+ "assign",
+ "atomic",
+ "atomicalign",
+ "bools",
+ "buildtag",
+ "cgocall",
+ "composites",
+ "copylocks",
+ "deepequalerrors",
+ "defers",
+ "directive",
+ "errorsas",
+ "fieldalignment",
+ "findcall",
+ "framepointer",
+ "httpresponse",
+ "ifaceassert",
+ "loopclosure",
+ "lostcancel",
+ "nilfunc",
+ "nilness",
+ "printf",
+ "reflectvaluecompare",
+ "shadow",
+ "shift",
+ "sigchanyzer",
+ "slog",
+ "sortslice",
+ "stdmethods",
+ "stringintconv",
+ "structtag",
+ "testinggoroutine",
+ "tests",
+ "unmarshal",
+ "unreachable",
+ "unsafeptr",
+ "unusedresult",
+ "unusedwrite"
+ ]
+ },
+ "revive-rules": {
+ "enum": [
+ "add-constant",
+ "argument-limit",
+ "atomic",
+ "banned-characters",
+ "bare-return",
+ "blank-imports",
+ "bool-literal-in-expr",
+ "call-to-gc",
+ "cognitive-complexity",
+ "comment-spacings",
+ "confusing-naming",
+ "confusing-results",
+ "constant-logical-expr",
+ "context-as-argument",
+ "context-keys-type",
+ "cyclomatic",
+ "datarace",
+ "deep-exit",
+ "defer",
+ "dot-imports",
+ "duplicated-imports",
+ "early-return",
+ "empty-block",
+ "empty-lines",
+ "enforce-map-style",
+ "enforce-repeated-arg-type-style",
+ "enforce-slice-style",
+ "error-naming",
+ "error-return",
+ "error-strings",
+ "errorf",
+ "exported",
+ "file-header",
+ "flag-parameter",
+ "function-length",
+ "function-result-limit",
+ "get-return",
+ "identical-branches",
+ "if-return",
+ "import-alias-naming",
+ "import-shadowing",
+ "imports-blocklist",
+ "increment-decrement",
+ "indent-error-flow",
+ "line-length-limit",
+ "max-control-nesting",
+ "max-public-structs",
+ "modifies-parameter",
+ "modifies-value-receiver",
+ "nested-structs",
+ "optimize-operands-order",
+ "package-comments",
+ "range",
+ "range-val-address",
+ "range-val-in-closure",
+ "receiver-naming",
+ "redefines-builtin-id",
+ "redundant-import-alias",
+ "string-format",
+ "string-of-int",
+ "struct-tag",
+ "superfluous-else",
+ "time-equal",
+ "time-naming",
+ "unchecked-type-assertion",
+ "unconditional-recursion",
+ "unexported-naming",
+ "unexported-return",
+ "unhandled-error",
+ "unnecessary-stmt",
+ "unreachable-code",
+ "unused-parameter",
+ "unused-receiver",
+ "use-any",
+ "useless-break",
+ "var-declaration",
+ "var-naming",
+ "waitgroup-by-value"
+ ]
+ },
+ "linters": {
+ "$comment": "anyOf with enum is used to allow auto completion of non-custom linters",
+ "description": "Linters usable.",
+ "anyOf": [
+ {
+ "enum": [
+ "asasalint",
+ "asciicheck",
+ "bidichk",
+ "bodyclose",
+ "canonicalheader",
+ "containedctx",
+ "contextcheck",
+ "copyloopvar",
+ "cyclop",
+ "deadcode",
+ "decorder",
+ "depguard",
+ "dogsled",
+ "dupl",
+ "dupword",
+ "durationcheck",
+ "errcheck",
+ "errchkjson",
+ "errname",
+ "errorlint",
+ "execinquery",
+ "exhaustive",
+ "exhaustivestruct",
+ "exhaustruct",
+ "exportloopref",
+ "fatcontext",
+ "forbidigo",
+ "forcetypeassert",
+ "funlen",
+ "gci",
+ "ginkgolinter",
+ "gocheckcompilerdirectives",
+ "gochecknoglobals",
+ "gochecknoinits",
+ "gochecksumtype",
+ "gocognit",
+ "goconst",
+ "gocritic",
+ "gocyclo",
+ "godot",
+ "godox",
+ "err113",
+ "gofmt",
+ "gofumpt",
+ "goheader",
+ "goimports",
+ "golint",
+ "gomoddirectives",
+ "gomodguard",
+ "goprintffuncname",
+ "gosec",
+ "gosimple",
+ "gosmopolitan",
+ "govet",
+ "grouper",
+ "ifshort",
+ "importas",
+ "inamedparam",
+ "ineffassign",
+ "interfacebloat",
+ "interfacer",
+ "intrange",
+ "ireturn",
+ "lll",
+ "loggercheck",
+ "maintidx",
+ "makezero",
+ "maligned",
+ "mirror",
+ "misspell",
+ "mnd",
+ "musttag",
+ "nakedret",
+ "nestif",
+ "nilerr",
+ "nilnil",
+ "nlreturn",
+ "noctx",
+ "nolintlint",
+ "nonamedreturns",
+ "nosnakecase",
+ "nosprintfhostport",
+ "paralleltest",
+ "perfsprint",
+ "prealloc",
+ "predeclared",
+ "promlinter",
+ "protogetter",
+ "reassign",
+ "revive",
+ "rowserrcheck",
+ "scopelint",
+ "sloglint",
+ "sqlclosecheck",
+ "staticcheck",
+ "structcheck",
+ "stylecheck",
+ "tagalign",
+ "tagliatelle",
+ "tenv",
+ "testableexamples",
+ "testifylint",
+ "testpackage",
+ "thelper",
+ "tparallel",
+ "typecheck",
+ "unconvert",
+ "unparam",
+ "unused",
+ "usestdlibvars",
+ "varcheck",
+ "varnamelen",
+ "wastedassign",
+ "whitespace",
+ "wrapcheck",
+ "wsl",
+ "zerologlint"
+ ]
+ },
+ {
+ "type": "string"
+ }
+ ]
+ }
+ },
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "run": {
+ "description": "Options for analysis running,",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "concurrency": {
+ "description": "Number of concurrent runners. Defaults to the number of available CPU cores.",
+ "type": "integer",
+ "minimum": 0,
+ "examples": [4]
+ },
+ "timeout": {
+ "description": "Timeout for the analysis.",
+ "type": "string",
+ "pattern": "^\\d*[sm]$",
+ "default": "1m",
+ "examples": ["30s", "5m"]
+ },
+ "issues-exit-code": {
+ "description": "Exit code when at least one issue was found.",
+ "type": "integer",
+ "default": 1
+ },
+ "tests": {
+ "description": "Enable inclusion of test files.",
+ "type": "boolean",
+ "default": true
+ },
+ "build-tags": {
+ "description": "List of build tags to pass to all linters.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "default": [],
+ "examples": [["mytag"]]
+ },
+ "modules-download-mode": {
+ "description": "Option to pass to \"go list -mod={option}\".\nSee \"go help modules\" for more information.",
+ "enum": ["mod", "readonly", "vendor"]
+ },
+ "allow-parallel-runners": {
+ "description": "Allow multiple parallel golangci-lint instances running. If disabled, golangci-lint acquires file lock on start.",
+ "type": "boolean",
+ "default": false
+ },
+ "allow-serial-runners": {
+ "description": "Allow multiple golangci-lint instances running, but serialize them around a lock.",
+ "type": "boolean",
+ "default": false
+ },
+ "go": {
+ "description": "Targeted Go version.",
+ "type": "string",
+ "default": "1.17"
+ }
+ }
+ },
+ "output": {
+ "description": "Output configuration options.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "formats": {
+ "description": "Output formats to use.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "path": {
+ "default": "stdout",
+ "anyOf": [
+ {
+ "enum": [ "stdout", "stderr" ]
+ },
+ {
+ "type": "string"
+ }
+ ]
+ },
+ "format": {
+ "default": "colored-line-number",
+ "enum": [
+ "colored-line-number",
+ "line-number",
+ "json",
+ "colored-tab",
+ "tab",
+ "html",
+ "checkstyle",
+ "code-climate",
+ "junit-xml",
+ "github-actions",
+ "teamcity",
+ "sarif"
+ ]
+ }
+ },
+ "required": ["format"]
+ }
+ },
+ "print-issued-lines": {
+ "description": "Print lines of code with issue.",
+ "type": "boolean",
+ "default": true
+ },
+ "print-linter-name": {
+ "description": "Print linter name in the end of issue text.",
+ "type": "boolean",
+ "default": true
+ },
+ "uniq-by-line": {
+ "description": "Make issues output unique by line.",
+ "type": "boolean",
+ "default": true
+ },
+ "path-prefix": {
+ "description": "Add a prefix to the output file references.",
+ "type": "string",
+ "default": ""
+ },
+ "show-stats": {
+ "description": "Show statistics per linter.",
+ "type": "boolean",
+ "default": false
+ },
+ "sort-order": {
+ "type": "array",
+ "items": {
+ "enum": ["linter", "severity", "file"]
+ }
+ },
+ "sort-results": {
+ "description": "Sort results by: filepath, line and column.",
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "linters-settings": {
+ "description": "All available settings of specific linters.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "dupword": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "keywords": {
+ "description": "Keywords for detecting duplicate words. If this list is not empty, only the words defined in this list will be detected.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "string",
+ "examples": ["the", "and", "a"]
+ }
+ },
+ "ignore": {
+ "description": "Keywords used to ignore detection.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "string",
+ "examples": ["0C0C"]
+ }
+ }
+ }
+ },
+ "asasalint": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "exclude": {
+ "description": "To specify a set of function names to exclude.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "string",
+ "examples": ["\\.Wrapf"]
+ }
+ },
+ "use-builtin-exclusions": {
+ "description": "To enable/disable the asasalint builtin exclusions of function names.",
+ "type": "boolean",
+ "default": true
+ },
+ "ignore-test": {
+ "description": "Ignore *_test.go files.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "bidichk": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "left-to-right-embedding": {
+ "description": "Disallow: LEFT-TO-RIGHT-EMBEDDING",
+ "type": "boolean",
+ "default": false
+ },
+ "right-to-left-embedding": {
+ "description": "Disallow: RIGHT-TO-LEFT-EMBEDDING",
+ "type": "boolean",
+ "default": false
+ },
+ "pop-directional-formatting": {
+ "description": "Disallow: POP-DIRECTIONAL-FORMATTING",
+ "type": "boolean",
+ "default": false
+ },
+ "left-to-right-override": {
+ "description": "Disallow: LEFT-TO-RIGHT-OVERRIDE",
+ "type": "boolean",
+ "default": false
+ },
+ "right-to-left-override": {
+ "description": "Disallow: RIGHT-TO-LEFT-OVERRIDE",
+ "type": "boolean",
+ "default": false
+ },
+ "left-to-right-isolate": {
+ "description": "Disallow: LEFT-TO-RIGHT-ISOLATE",
+ "type": "boolean",
+ "default": false
+ },
+ "right-to-left-isolate": {
+ "description": "Disallow: RIGHT-TO-LEFT-ISOLATE",
+ "type": "boolean",
+ "default": false
+ },
+ "first-strong-isolate": {
+ "description": "Disallow: FIRST-STRONG-ISOLATE",
+ "type": "boolean",
+ "default": false
+ },
+ "pop-directional-isolate": {
+ "description": "Disallow: POP-DIRECTIONAL-ISOLATE",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "cyclop": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "skip-tests": {
+ "description": "Should the linter execute on test files as well",
+ "type": "boolean",
+ "default": false
+ },
+ "max-complexity": {
+ "description": "Max complexity the function can have",
+ "type": "integer",
+ "default": 10,
+ "minimum": 0
+ },
+ "package-average": {
+ "description": "Max average complexity in package",
+ "type": "number",
+ "default": 0,
+ "minimum": 0
+ }
+ }
+ },
+ "decorder": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "dec-order": {
+ "type": "array",
+ "default": [["type", "const", "var", "func"]],
+ "items": {
+ "enum": ["type", "const", "var", "func"]
+ }
+ },
+ "ignore-underscore-vars": {
+ "description": "Underscore vars (vars with \"_\" as the name) will be ignored at all checks",
+ "default": true,
+ "type": "boolean"
+ },
+ "disable-dec-order-check": {
+ "description": "Order of declarations is not checked",
+ "default": true,
+ "type": "boolean"
+ },
+ "disable-init-func-first-check": {
+ "description": "Allow init func to be anywhere in file",
+ "default": true,
+ "type": "boolean"
+ },
+ "disable-dec-num-check": {
+ "description": "Multiple global type, const and var declarations are allowed",
+ "default": true,
+ "type": "boolean"
+ },
+ "disable-type-dec-num-check": {
+ "description": "Type declarations will be ignored for dec num check",
+ "default": true,
+ "type": "boolean"
+ },
+ "disable-const-dec-num-check": {
+ "description": "Const declarations will be ignored for dec num check",
+ "default": true,
+ "type": "boolean"
+ },
+ "disable-var-dec-num-check": {
+ "description": "Var declarations will be ignored for dec num check",
+ "default": true,
+ "type": "boolean"
+ }
+ }
+ },
+ "depguard": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "rules": {
+ "description": "Rules to apply.",
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^[^.]+$": {
+ "description": "Name of a rule.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "list-mode": {
+ "description": "Used to determine the package matching priority.",
+ "enum": ["original", "strict", "lax"],
+ "default": "original"
+ },
+ "files": {
+ "description": "List of file globs that will match this list of settings to compare against.",
+ "additionalProperties": false,
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "allow": {
+ "description": "List of allowed packages.",
+ "additionalProperties": false,
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "deny": {
+ "description": "Packages that are not allowed where the value is a suggestion.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "desc": {
+ "description": "Description",
+ "type": "string"
+ },
+ "pkg": {
+ "description": "Package",
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "dogsled": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "max-blank-identifiers": {
+ "description": "Check assignments with too many blank identifiers.",
+ "type": "integer",
+ "default": 2,
+ "minimum": 0
+ }
+ }
+ },
+ "dupl": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "threshold": {
+ "description": "Tokens count to trigger issue.",
+ "type": "integer",
+ "default": 150,
+ "minimum": 0
+ }
+ }
+ },
+ "errcheck": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "check-type-assertions": {
+ "description": "Report about not checking errors in type assertions, i.e.: `a := b.(MyStruct)`",
+ "type": "boolean",
+ "default": false
+ },
+ "check-blank": {
+ "description": "Report about assignment of errors to blank identifier",
+ "type": "boolean",
+ "default": false
+ },
+ "exclude-functions": {
+ "description": "List of functions to exclude from checking, where each entry is a single function to exclude",
+ "type": "array",
+ "examples": ["io/ioutil.ReadFile", "io.Copy(*bytes.Buffer)"],
+ "items": {
+ "type": "string"
+ }
+ },
+ "disable-default-exclusions": {
+ "description": "To disable the errcheck built-in exclude list",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "errchkjson": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "check-error-free-encoding": {
+ "type": "boolean",
+ "default": false
+ },
+ "report-no-exported": {
+ "description": "Issue on struct that doesn't have exported fields.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "errorlint": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "errorf": {
+ "description": "Check whether fmt.Errorf uses the %w verb for formatting errors",
+ "type": "boolean",
+ "default": true
+ },
+ "errorf-multi": {
+ "description": "Permit more than 1 %w verb, valid per Go 1.20",
+ "type": "boolean",
+ "default": true
+ },
+ "asserts": {
+ "description": "Check for plain type assertions and type switches.",
+ "type": "boolean",
+ "default": true
+ },
+ "comparison": {
+ "description": "Check for plain error comparisons",
+ "type": "boolean",
+ "default": true
+ },
+ "allowed-errors": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "err": {
+ "type": "string"
+ },
+ "fun": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "allowed-errors-wildcard": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "err": {
+ "type": "string"
+ },
+ "fun": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "exhaustive": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "check": {
+ "description": "Program elements to check for exhaustiveness.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "string",
+ "examples": ["switch", "map"]
+ }
+ },
+ "check-generated": {
+ "description": "Check switch statements in generated files",
+ "type": "boolean",
+ "default": false
+ },
+ "explicit-exhaustive-switch": {
+ "description": "Only run exhaustive check on switches with \"//exhaustive:enforce\" comment.",
+ "type": "boolean",
+ "default": false
+ },
+ "explicit-exhaustive-map": {
+ "description": "Only run exhaustive check on map literals with \"//exhaustive:enforce\" comment.",
+ "type": "boolean",
+ "default": false
+ },
+ "default-case-required": {
+ "description": "Switch statement requires default case even if exhaustive.",
+ "type": "boolean",
+ "default": false
+ },
+ "default-signifies-exhaustive": {
+ "description": "Presence of `default` case in switch statements satisfies exhaustiveness, even if all enum members are not listed.",
+ "type": "boolean",
+ "default": false
+ },
+ "ignore-enum-members": {
+ "description": "Enum members matching `regex` do not have to be listed in switch statements to satisfy exhaustiveness",
+ "type": "string"
+ },
+ "ignore-enum-types": {
+ "description": "Enum types matching the supplied regex do not have to be listed in switch statements to satisfy exhaustiveness.",
+ "type": "string"
+ },
+ "package-scope-only": {
+ "description": "Consider enums only in package scopes, not in inner scopes.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "exhaustruct": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "include": {
+ "description": "List of regular expressions to match struct packages and names.",
+ "type": "array",
+ "examples": [".*\\.Test"],
+ "items": {
+ "type": "string"
+ }
+ },
+ "exclude": {
+ "description": "List of regular expressions to exclude struct packages and names from check.",
+ "type": "array",
+ "examples": ["cobra\\.Command$"],
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "forbidigo": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "exclude-godoc-examples": {
+ "description": "Exclude code in godoc examples.",
+ "type": "boolean",
+ "default": true
+ },
+ "analyze-types": {
+ "description": "Instead of matching the literal source code, use type information to replace expressions with strings that contain the package name and (for methods and fields) the type name.",
+ "type": "boolean",
+ "default": true
+ },
+ "forbid": {
+ "description": "List of identifiers to forbid (written using `regexp`)",
+ "type": "array",
+ "examples": ["^print.*$"],
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "p": {
+ "description": "Pattern",
+ "type": "string"
+ },
+ "pkg": {
+ "description": "Package",
+ "type": "string"
+ },
+ "msg": {
+ "description": "Message",
+ "type": "string"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "funlen": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "lines": {
+ "description": "Limit lines number per function.",
+ "type": "integer",
+ "default": 60
+ },
+ "statements": {
+ "description": "Limit statements number per function.",
+ "type": "integer",
+ "default": 40
+ },
+ "ignore-comments": {
+ "description": "Ignore comments when counting lines.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "gci": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "sections": {
+ "description": "Section configuration to compare against.",
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "enum": [
+ "standard",
+ "default",
+ "blank",
+ "dot",
+ "alias",
+ "localmodule"
+ ]
+ },
+ {
+ "type": "string"
+ }
+ ]
+ },
+ "default": ["standard", "default"]
+ },
+ "skip-generated": {
+ "description": "Skip generated files.",
+ "type": "boolean",
+ "default": true
+ },
+ "custom-order": {
+ "description": "Enable custom order of sections.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "ginkgolinter": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "suppress-len-assertion": {
+ "description": "Suppress the wrong length assertion warning.",
+ "type": "boolean",
+ "default": false
+ },
+ "suppress-nil-assertion": {
+ "description": "Suppress the wrong nil assertion warning.",
+ "type": "boolean",
+ "default": false
+ },
+ "suppress-err-assertion": {
+ "description": "Suppress the wrong error assertion warning.",
+ "type": "boolean",
+ "default": false
+ },
+ "suppress-compare-assertion": {
+ "description": "Suppress the wrong comparison assertion warning.",
+ "type": "boolean",
+ "default": false
+ },
+ "suppress-async-assertion": {
+ "description": "Suppress the function all in async assertion warning.",
+ "type": "boolean",
+ "default": false
+ },
+ "suppress-type-compare-assertion": {
+ "description": "Suppress warning for comparing values from different types, like int32 and uint32.",
+ "type": "boolean",
+ "default": false
+ },
+ "forbid-focus-container": {
+ "description": "Trigger warning for ginkgo focus containers like FDescribe, FContext, FWhen or FIt.",
+ "type": "boolean",
+ "default": false
+ },
+ "allow-havelen-zero": {
+ "description": "Don't trigger warnings for HaveLen(0).",
+ "type": "boolean",
+ "default": false
+ },
+ "force-expect-to": {
+ "description": "Force using `Expect` with `To`, `ToNot` or `NotTo`",
+ "type": "boolean",
+ "default": false
+ },
+ "validate-async-intervals": {
+ "description": "Best effort validation of async intervals (timeout and polling).",
+ "type": "boolean",
+ "default": false
+ },
+ "forbid-spec-pollution": {
+ "description": "Trigger a warning for variable assignments in ginkgo containers like `Describe`, `Context` and `When`, instead of in `BeforeEach()`.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "gocognit": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "min-complexity": {
+ "description": "Minimal code complexity to report (we recommend 10-20).",
+ "type": "integer",
+ "default": 30
+ }
+ }
+ },
+ "goconst": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "match-constant": {
+ "description": "Look for existing constants matching the values",
+ "type": "boolean",
+ "default": true
+ },
+ "min-len": {
+ "description": "Minimum length of string constant.",
+ "type": "integer",
+ "default": 3
+ },
+ "min-occurrences": {
+ "description": "Minimum occurrences count to trigger.",
+ "type": "integer",
+ "default": 3
+ },
+ "ignore-tests": {
+ "description": "Ignore test files.",
+ "type": "boolean",
+ "default": false
+ },
+ "ignore-calls": {
+ "description": "Ignore when constant is not used as function argument",
+ "type": "boolean",
+ "default": true
+ },
+ "ignore-strings": {
+ "description": "Exclude strings matching the given regular expression",
+ "type": "string"
+ },
+ "numbers": {
+ "description": "Search also for duplicated numbers.",
+ "type": "boolean",
+ "default": false
+ },
+ "min": {
+ "description": "Minimum value, only works with `numbers`",
+ "type": "integer",
+ "default": 3
+ },
+ "max": {
+ "description": "Maximum value, only works with `numbers`",
+ "type": "integer",
+ "default": 3
+ }
+ }
+ },
+ "gocritic": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "enabled-checks": {
+ "description": "Which checks should be enabled. By default, a list of stable checks is used. To see it, run `GL_DEBUG=gocritic golangci-lint run`.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/gocritic-checks"
+ }
+ },
+ "disabled-checks": {
+ "description": "Which checks should be disabled.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/gocritic-checks"
+ },
+ "default": []
+ },
+ "enabled-tags": {
+ "description": "Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/gocritic-tags"
+ }
+ },
+ "disabled-tags": {
+ "description": "Disable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/gocritic-tags"
+ }
+ },
+ "settings": {
+ "description": "Settings passed to gocritic. Properties must be valid and enabled check names.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "captLocal": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "paramsOnly" : {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "commentedOutCode": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "minLength" : {
+ "type": "number",
+ "default": 15
+ }
+ }
+ },
+ "elseif": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "skipBalanced" : {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "hugeParam": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "sizeThreshold" : {
+ "type": "number",
+ "default": 80
+ }
+ }
+ },
+ "ifElseChain": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "minThreshold" : {
+ "type": "number",
+ "default": 2
+ }
+ }
+ },
+ "nestingReduce": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "bodyWidth" : {
+ "type": "number",
+ "default": 5
+ }
+ }
+ },
+ "rangeExprCopy": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "sizeThreshold" : {
+ "type": "number",
+ "default": 512
+ },
+ "skipTestFuncs" : {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "rangeValCopy": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "sizeThreshold" : {
+ "type": "number",
+ "default": 128
+ },
+ "skipTestFuncs" : {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "ruleguard": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "debug" : {
+ "type": "string"
+ },
+ "enable" : {
+ "type": "string"
+ },
+ "disable" : {
+ "type": "string"
+ },
+ "failOn" : {
+ "type": "string"
+ },
+ "rules" : {
+ "type": "string"
+ }
+ }
+ },
+ "tooManyResultsChecker": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "maxResults" : {
+ "type": "number",
+ "default": 5
+ }
+ }
+ },
+ "truncateCmp": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "skipArchDependent" : {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "underef": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "skipRecvDeref" : {
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "unnamedResult": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "checkExported" : {
+ "type": "boolean",
+ "default": false
+ }
+ }
+ }
+ }
+ },
+ "disable-all": {
+ "type": "boolean",
+ "default": false
+ },
+ "enable-all": {
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "gocyclo": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "min-complexity": {
+ "description": "Minimum code complexity to report (we recommend 10-20).",
+ "type": "integer",
+ "default": 30
+ }
+ }
+ },
+ "godot": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "scope": {
+ "description": "Comments to be checked.",
+ "enum": ["declarations", "toplevel", "all"],
+ "default": "declarations"
+ },
+ "exclude": {
+ "description": "List of regexps for excluding particular comment lines from check.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "period": {
+ "description": "Check that each sentence ends with a period.",
+ "type": "boolean",
+ "default": true
+ },
+ "capital": {
+ "description": "Check that each sentence starts with a capital letter.",
+ "type": "boolean",
+ "default": false
+ },
+ "check-all": {
+ "description": "DEPRECATED: Check all top-level comments, not only declarations.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "godox": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "keywords": {
+ "description": "Report any comments starting with one of these keywords. This is useful for TODO or FIXME comments that might be left in the code accidentally and should be resolved before merging.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "default": ["TODO", "BUG", "FIXME"]
+ }
+ }
+ },
+ "gofmt": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "simplify": {
+ "description": "Simplify code.",
+ "type": "boolean",
+ "default": true
+ },
+ "rewrite-rules": {
+ "description": "Apply the rewrite rules to the source before reformatting.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "pattern": {
+ "type": "string"
+ },
+ "replacement": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "interfacebloat": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "max": {
+ "description": "The maximum number of methods allowed for an interface.",
+ "type": "integer"
+ }
+ }
+ },
+ "gofumpt": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "extra-rules": {
+ "description": "Choose whether or not to use the extra rules that are disabled by default.",
+ "type": "boolean",
+ "default": false
+ },
+ "module-path": {
+ "description": " Module path which contains the source code being formatted.",
+ "type": "string"
+ }
+ }
+ },
+ "goheader": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "values": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "const": {
+ "description": "Constants to use in the template.",
+ "type": "object",
+ "patternProperties": {
+ "^.+$": {
+ "description": "Value for the constant.",
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "examples": [
+ {
+ "YEAR": "2030",
+ "COMPANY": "MY FUTURISTIC COMPANY"
+ }
+ ]
+ },
+ "regexp": {
+ "description": "Regular expressions to use in your template.",
+ "type": "object",
+ "additionalProperties": false,
+ "patternProperties": {
+ "^.+$": {
+ "type": "string"
+ }
+ },
+ "examples": [
+ {
+ "AUTHOR": ".*@mycompany\\.com"
+ }
+ ]
+ }
+ }
+ },
+ "template": {
+ "description": "Template to put on top of every file.",
+ "type": "string",
+ "examples": [
+ "{{ MY COMPANY }}\nSPDX-License-Identifier: Apache-2.0\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at:\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License."
+ ]
+ },
+ "template-path": {
+ "description": "Path to the file containing the template source.",
+ "type": "string",
+ "examples": ["my_header_template.txt"]
+ }
+ },
+ "oneOf": [
+ { "required": ["template"] },
+ { "required": ["template-path"] }
+ ]
+ },
+ "goimports": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "local-prefixes": {
+ "description": "Put imports beginning with prefix after 3rd-party packages. It is a comma-separated list of prefixes.",
+ "type": "string",
+ "examples": ["github.com/org/project"]
+ }
+ }
+ },
+ "gomoddirectives": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "replace-local": {
+ "description": "Allow local `replace` directives.",
+ "type": "boolean",
+ "default": true
+ },
+ "replace-allow-list": {
+ "description": "List of allowed `replace` directives.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "retract-allow-no-explanation": {
+ "description": "Allow to not explain why the version has been retracted in the `retract` directives.",
+ "type": "boolean",
+ "default": true
+ },
+ "exclude-forbidden": {
+ "description": "Forbid the use of the `exclude` directives.",
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "gomodguard": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "allowed": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "modules": {
+ "description": "List of allowed modules.",
+ "type": "array",
+ "items": {
+ "type": "string",
+ "examples": ["gopkg.in/yaml.v2"]
+ }
+ },
+ "domains": {
+ "description": "List of allowed module domains.",
+ "type": "array",
+ "items": {
+ "type": "string",
+ "examples": ["golang.org"]
+ }
+ }
+ }
+ },
+ "blocked": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "modules": {
+ "description": "List of blocked modules.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "patternProperties": {
+ "^.+$": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "recommendations": {
+ "description": "Recommended modules that should be used instead.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "reason": {
+ "description": "Reason why the recommended module should be used.",
+ "type": "string"
+ }
+ }
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "versions": {
+ "description": "List of blocked module version constraints.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "patternProperties": {
+ "^.*$": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "version": {
+ "description": "Version constraint.",
+ "type": "string"
+ },
+ "reason": {
+ "description": "Reason why the version constraint exists.",
+ "type": "string"
+ }
+ },
+ "required": ["reason"]
+ }
+ }
+ }
+ },
+ "local_replace_directives": {
+ "description": "Raise lint issues if loading local path with replace directive",
+ "type": "boolean",
+ "default": true
+ }
+ }
+ }
+ }
+ },
+ "gosimple": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "checks": {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "enum": ["all"]
+ },
+ {
+ "type": "string"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "gosec": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "includes": {
+ "type": "array",
+ "description": "To select a subset of rules to run",
+ "examples": [["G401"]],
+ "items": {
+ "$ref": "#/definitions/gosec-rules"
+ }
+ },
+ "excludes": {
+ "type": "array",
+ "description": "To specify a set of rules to explicitly exclude",
+ "examples": [["G401"]],
+ "items": {
+ "$ref": "#/definitions/gosec-rules"
+ }
+ },
+ "exclude-generated": {
+ "description": "Exclude generated files",
+ "type": "boolean",
+ "default": false
+ },
+ "severity": {
+ "description": "Filter out the issues with a lower severity than the given value",
+ "type": "string",
+ "enum": ["low", "medium", "high"],
+ "default": "low"
+ },
+ "confidence": {
+ "description": "Filter out the issues with a lower confidence than the given value",
+ "type": "string",
+ "enum": ["low", "medium", "high"],
+ "default": "low"
+ },
+ "config": {
+ "description": "To specify the configuration of rules",
+ "type": "object"
+ },
+ "concurrency": {
+ "description": "Concurrency value",
+ "type": "integer"
+ }
+ }
+ },
+ "gosmopolitan": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "allow-time-local": {
+ "description": "Allow and ignore `time.Local` usages.",
+ "type": "boolean",
+ "default": false
+ },
+ "escape-hatches": {
+ "description": "List of fully qualified names in the `full/pkg/path.name` form, to act as \"i18n escape hatches\".",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ignore-tests": {
+ "description": "Ignore test files.",
+ "type": "boolean",
+ "default": false
+ },
+ "watch-for-scripts": {
+ "description": "List of Unicode scripts to watch for any usage in string literals.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "govet": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "settings": {
+ "description": "Settings per analyzer. Map of analyzer name to specific settings.\nRun `go tool vet help` to find out more.",
+ "type": "object",
+ "propertyNames": {
+ "$ref": "#/definitions/govet-analyzers"
+ },
+ "patternProperties": {
+ "^.*$": {
+ "description": "Run `go tool vet help ` to see all settings.",
+ "type": "object"
+ }
+ }
+ },
+ "enable": {
+ "description": "Enable analyzers by name.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/govet-analyzers"
+ }
+ },
+ "disable": {
+ "description": "Disable analyzers by name.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/govet-analyzers"
+ }
+ },
+ "enable-all": {
+ "description": "Enable all analyzers.",
+ "type": "boolean",
+ "default": false
+ },
+ "disable-all": {
+ "description": "Disable all analyzers.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "grouper": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "const-require-single-const": {
+ "type": "boolean",
+ "default": false
+ },
+ "const-require-grouping": {
+ "type": "boolean",
+ "default": false
+ },
+ "import-require-single-import": {
+ "type": "boolean",
+ "default": false
+ },
+ "import-require-grouping": {
+ "type": "boolean",
+ "default": false
+ },
+ "type-require-single-type": {
+ "type": "boolean",
+ "default": false
+ },
+ "type-require-grouping": {
+ "type": "boolean",
+ "default": false
+ },
+ "var-require-single-var": {
+ "type": "boolean",
+ "default": false
+ },
+ "var-require-grouping": {
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "importas": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "no-unaliased": {
+ "description": "Do not allow unaliased imports of aliased packages.",
+ "type": "boolean",
+ "default": false
+ },
+ "no-extra-aliases": {
+ "description": "Do not allow non-required aliases.",
+ "type": "boolean",
+ "default": false
+ },
+ "alias": {
+ "description": "List of aliases",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "pkg": {
+ "description": "Package path e.g. knative.dev/serving/pkg/apis/autoscaling/v1alpha1",
+ "type": "string"
+ },
+ "alias": {
+ "description": "Package alias e.g. autoscalingv1alpha1",
+ "type": "string"
+ }
+ },
+ "required": ["pkg", "alias"]
+ }
+ }
+ }
+ },
+ "inamedparam": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "skip-single-param": {
+ "description": "Skips check for interface methods with only a single parameter.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "ireturn": {
+ "type": "object",
+ "additionalProperties": false,
+ "description": "Use either `reject` or `allow` properties for interfaces matching.",
+ "properties": {
+ "allow": {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "enum": ["anon", "error", "empty", "stdlib"]
+ }
+ ]
+ }
+ },
+ "reject": {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "enum": ["anon", "error", "empty", "stdlib"]
+ }
+ ]
+ }
+ }
+ },
+ "anyOf": [
+ {
+ "not": {
+ "properties": {
+ "allow": {
+ "const": "reject"
+ }
+ }
+ },
+ "required": ["allow"]
+ },
+ {
+ "required": ["reject"]
+ }
+ ]
+ },
+ "lll": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "tab-width": {
+ "description": "Width of \"\\t\" in spaces.",
+ "type": "integer",
+ "minimum": 0,
+ "default": 1
+ },
+ "line-length": {
+ "description": "Maximum allowed line length, lines longer will be reported.",
+ "type": "integer",
+ "minimum": 1,
+ "default": 120
+ }
+ }
+ },
+ "maintidx": {
+ "description": "Maintainability index https://docs.microsoft.com/en-us/visualstudio/code-quality/code-metrics-maintainability-index-range-and-meaning?view=vs-2022",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "under": {
+ "description": "Minimum accatpable maintainability index level (see https://docs.microsoft.com/en-us/visualstudio/code-quality/code-metrics-maintainability-index-range-and-meaning?view=vs-2022)",
+ "type": "number",
+ "default": 20
+ }
+ }
+ },
+ "makezero": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "always": {
+ "description": "Allow only slices initialized with a length of zero.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "loggercheck": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "kitlog": {
+ "description": "Allow check for the github.com/go-kit/log library.",
+ "type": "boolean",
+ "default": true
+ },
+ "klog": {
+ "description": "Allow check for the k8s.io/klog/v2 library.",
+ "type": "boolean",
+ "default": true
+ },
+ "logr": {
+ "description": "Allow check for the github.com/go-logr/logr library.",
+ "type": "boolean",
+ "default": true
+ },
+ "zap": {
+ "description": "Allow check for the \"sugar logger\" from go.uber.org/zap library.",
+ "type": "boolean",
+ "default": true
+ },
+ "require-string-key": {
+ "description": "Require all logging keys to be inlined constant strings.",
+ "type": "boolean",
+ "default": false
+ },
+ "no-printf-like": {
+ "description": "Require printf-like format specifier (%s, %d for example) not present.",
+ "type": "boolean",
+ "default": false
+ },
+ "rules": {
+ "description": "List of custom rules to check against, where each rule is a single logger pattern, useful for wrapped loggers.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "misspell": {
+ "description": "Correct spellings using locale preferences for US or UK. Default is to use a neutral variety of English.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "locale": {
+ "enum": ["US", "UK"]
+ },
+ "ignore-words": {
+ "description": "List of words to ignore.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "mode": {
+ "description": "Mode of the analysis.",
+ "enum": ["restricted", "", "default"],
+ "default": ""
+ },
+ "extra-words": {
+ "description": "Extra word corrections.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "correction": {
+ "type": "string"
+ },
+ "typo": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "musttag": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "functions": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "tag": {
+ "type": "string"
+ },
+ "arg-pos": {
+ "type": "integer"
+ }
+ }
+ }
+ }
+ }
+ },
+ "nakedret": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "max-func-lines": {
+ "description": "Report if a function has more lines of code than this value and it has naked returns.",
+ "type": "integer",
+ "minimum": 0,
+ "default": 30
+ }
+ }
+ },
+ "nestif": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "min-complexity": {
+ "description": "Minimum complexity of \"if\" statements to report.",
+ "type": "integer",
+ "default": 5
+ }
+ }
+ },
+ "nilnil": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "checked-types": {
+ "type": "array",
+ "description": "List of return types to check.",
+ "items": {
+ "enum": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"]
+ },
+ "default": ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"]
+ }
+ }
+ },
+ "nlreturn": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "block-size": {
+ "description": "set block size that is still ok",
+ "type": "number",
+ "default": 0,
+ "minimum": 0
+ }
+ }
+ },
+ "mnd": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "ignored-files": {
+ "description": "List of file patterns to exclude from analysis.",
+ "examples": [["magic1_.*.go"]],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ignored-functions": {
+ "description": "Comma-separated list of function patterns to exclude from the analysis.",
+ "examples": [["math.*", "http.StatusText", "make"]],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ignored-numbers": {
+ "description": "List of numbers to exclude from analysis.",
+ "examples": [["1000", "1234_567_890", "3.14159264"]],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "checks": {
+ "description": "The list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.",
+ "type": "array",
+ "items": {
+ "enum": [
+ "argument",
+ "case",
+ "condition",
+ "operation",
+ "return",
+ "assign"
+ ]
+ }
+ }
+ }
+ },
+ "nolintlint": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "allow-unused": {
+ "description": "Enable to ensure that nolint directives are all used.",
+ "type": "boolean",
+ "default": true
+ },
+ "allow-no-explanation": {
+ "description": "Exclude these linters from requiring an explanation.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/linters"
+ },
+ "default": []
+ },
+ "require-explanation": {
+ "description": "Enable to require an explanation of nonzero length after each nolint directive.",
+ "type": "boolean",
+ "default": false
+ },
+ "require-specific": {
+ "description": "Enable to require nolint directives to mention the specific linter being suppressed.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "reassign": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "patterns": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "nonamedreturns": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "report-error-in-defer": {
+ "description": "Report named error if it is assigned inside defer.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "paralleltest": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "ignore-missing": {
+ "description": "Ignore missing calls to `t.Parallel()` and only report incorrect uses of it.",
+ "type": "boolean",
+ "default": false
+ },
+ "ignore-missing-subtests": {
+ "description": "Ignore missing calls to `t.Parallel()` in subtests. Top-level tests are still required to have `t.Parallel`, but subtests are allowed to skip it.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "perfsprint": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "int-conversion": {
+ "description": "Optimizes even if it requires an int or uint type cast.",
+ "type": "boolean",
+ "default": true
+ },
+ "err-error": {
+ "description": "Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.",
+ "type": "boolean",
+ "default": false
+ },
+ "errorf": {
+ "description": "Optimizes `fmt.Errorf`.",
+ "type": "boolean",
+ "default": true
+ },
+ "sprintf1": {
+ "description": "Optimizes `fmt.Sprintf` with only one argument.",
+ "type": "boolean",
+ "default": true
+ },
+ "strconcat": {
+ "description": "Optimizes into strings concatenation.",
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "prealloc": {
+ "description": "We do not recommend using this linter before doing performance profiling.\nFor most programs usage of `prealloc` will be premature optimization.",
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "simple": {
+ "description": "Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.",
+ "type": "boolean",
+ "default": true
+ },
+ "range-loops": {
+ "description": "Report preallocation suggestions on range loops.",
+ "type": "boolean",
+ "default": true
+ },
+ "for-loops": {
+ "description": "Report preallocation suggestions on for loops.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "predeclared": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "ignore": {
+ "description": "Comma-separated list of predeclared identifiers to not report on.",
+ "type": "string"
+ },
+ "q": {
+ "description": "Include method names and field names (i.e., qualified names) in checks.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "promlinter": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "strict": {},
+ "disabled-linters": {
+ "type": "array",
+ "items": {
+ "enum": [
+ "Help",
+ "MetricUnits",
+ "Counter",
+ "HistogramSummaryReserved",
+ "MetricTypeInName",
+ "ReservedChars",
+ "CamelCase",
+ "UnitAbbreviations"
+ ]
+ }
+ }
+ }
+ },
+ "protogetter": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "skip-generated-by": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "examples": ["protoc-gen-go-my-own-generator"]
+ }
+ },
+ "skip-files": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "examples": ["*.pb.go"]
+ }
+ },
+ "skip-any-generated": {
+ "description": "Skip any generated files from the checking.",
+ "type": "boolean",
+ "default": false
+ },
+ "replace-first-arg-in-append": {
+ "description": "Skip first argument of append function.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "revive": {
+ "type": "object",
+ "additionalProperties": false,
+ "examples": [
+ {
+ "ignore-generated-header": true,
+ "severity": "warning",
+ "rules": [
+ {
+ "name": "indent-error-flow",
+ "severity": "warning"
+ },
+ {
+ "name": "add-constant",
+ "severity": "warning",
+ "arguments": [
+ {
+ "maxLitCount": "3",
+ "allowStrs": "\"\"",
+ "allowInts": "0,1,2",
+ "allowFloats": "0.0,0.,1.0,1.,2.0,2."
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "properties": {
+ "max-open-files": {
+ "type": "integer"
+ },
+ "ignore-generated-header": {
+ "type": "boolean"
+ },
+ "confidence": {
+ "type": "number"
+ },
+ "severity": {
+ "type": "string",
+ "enum": ["warning", "error"]
+ },
+ "enable-all-rules": {
+ "type": "boolean",
+ "default": false
+ },
+ "rules": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": ["name"],
+ "properties": {
+ "name": {
+ "$ref": "#/definitions/revive-rules",
+ "title": "The rule name"
+ },
+ "disabled": {
+ "type": "boolean"
+ },
+ "severity": {
+ "type": "string",
+ "enum": ["warning", "error"]
+ },
+ "exclude": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "arguments": {
+ "type": "array"
+ }
+ }
+ }
+ }
+ }
+ },
+ "rowserrcheck": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "packages": {
+ "type": "array",
+ "items": {
+ "description": "",
+ "type": "string",
+ "examples": ["github.com/jmoiron/sqlx"]
+ }
+ }
+ }
+ },
+ "sloglint": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "kv-only": {
+ "description": "Enforce using key-value pairs only (incompatible with attr-only).",
+ "type": "boolean",
+ "default": false
+ },
+ "no-global": {
+ "description": "Enforce not using global loggers.",
+ "enum": ["", "all", "default"],
+ "default": ""
+ },
+ "no-mixed-args": {
+ "description": "Enforce not mixing key-value pairs and attributes.",
+ "type": "boolean",
+ "default": true
+ },
+ "context": {
+ "description": "Enforce using methods that accept a context.",
+ "enum": ["", "all", "scope"],
+ "default": ""
+ },
+ "static-msg": {
+ "description": "Enforce using static values for log messages.",
+ "type": "boolean",
+ "default": false
+ },
+ "key-naming-case": {
+ "description": "Enforce a single key naming convention.",
+ "enum": ["snake", "kebab", "camel", "pascal"]
+ },
+ "attr-only": {
+ "description": "Enforce using attributes only (incompatible with kv-only).",
+ "type": "boolean",
+ "default": false
+ },
+ "no-raw-keys": {
+ "description": "Enforce using constants instead of raw keys.",
+ "type": "boolean",
+ "default": false
+ },
+ "forbidden-keys": {
+ "description": "Enforce not using specific keys.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "args-on-sep-lines": {
+ "description": "Enforce putting arguments on separate lines.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "spancheck": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "checks": {
+ "description": "Checks to enable.",
+ "type": "array",
+ "items": {
+ "enum": ["end", "record-error", "set-status"]
+ }
+ },
+ "ignore-check-signatures": {
+ "description": "A list of regexes for function signatures that silence `record-error` and `set-status` reports if found in the call path to a returned error.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "extra-start-span-signatures": {
+ "description": "A list of regexes for additional function signatures that create spans.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "staticcheck": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "checks": {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "enum": ["all"]
+ },
+ {
+ "type": "string"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "stylecheck": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "checks": {
+ "type": "array",
+ "items": {
+ "anyOf": [
+ {
+ "enum": ["all"]
+ },
+ {
+ "type": "string"
+ }
+ ]
+ },
+ "default": [
+ "all",
+ "-ST1000",
+ "-ST1003",
+ "-ST1016",
+ "-ST1020",
+ "-ST1021",
+ "-ST1022"
+ ]
+ },
+ "dot-import-whitelist": {
+ "description": "By default, ST1001 forbids all uses of dot imports in non-test packages. This setting allows setting a whitelist of import paths that can be dot-imported anywhere.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "http-status-code-whitelist": {
+ "description": "ST1013 recommends using constants from the net/http package instead of hard-coding numeric HTTP status codes. This setting specifies a list of numeric status codes that this check does not complain about.",
+ "default": ["200", "400", "404", "500"],
+ "type": "array",
+ "items": {
+ "enum": [
+ "100",
+ "101",
+ "102",
+ "103",
+ "200",
+ "201",
+ "202",
+ "203",
+ "204",
+ "205",
+ "206",
+ "207",
+ "208",
+ "226",
+ "300",
+ "301",
+ "302",
+ "303",
+ "304",
+ "305",
+ "306",
+ "307",
+ "308",
+ "400",
+ "401",
+ "402",
+ "403",
+ "404",
+ "405",
+ "406",
+ "407",
+ "408",
+ "409",
+ "410",
+ "411",
+ "412",
+ "413",
+ "414",
+ "415",
+ "416",
+ "417",
+ "418",
+ "421",
+ "422",
+ "423",
+ "424",
+ "425",
+ "426",
+ "428",
+ "429",
+ "431",
+ "451",
+ "500",
+ "501",
+ "502",
+ "503",
+ "504",
+ "505",
+ "506",
+ "507",
+ "508",
+ "510",
+ "511"
+ ]
+ }
+ },
+ "initialisms": {
+ "description": "ST1003 check, among other things, for the correct capitalization of initialisms. The set of known initialisms can be configured with this option.",
+ "type": "array",
+ "items": {
+ "type": "string",
+ "default": [
+ "ACL",
+ "API",
+ "ASCII",
+ "CPU",
+ "CSS",
+ "DNS",
+ "EOF",
+ "GUID",
+ "HTML",
+ "HTTP",
+ "HTTPS",
+ "ID",
+ "IP",
+ "JSON",
+ "QPS",
+ "RAM",
+ "RPC",
+ "SLA",
+ "SMTP",
+ "SQL",
+ "SSH",
+ "TCP",
+ "TLS",
+ "TTL",
+ "UDP",
+ "UI",
+ "GID",
+ "UID",
+ "UUID",
+ "URI",
+ "URL",
+ "UTF8",
+ "VM",
+ "XML",
+ "XMPP",
+ "XSRF",
+ "XSS",
+ "SIP",
+ "RTP",
+ "AMQP",
+ "DB",
+ "TS"
+ ]
+ }
+ }
+ }
+ },
+ "tagalign": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "align": {
+ "description": "Align and sort can be used together or separately.",
+ "type": "boolean",
+ "default": true
+ },
+ "sort": {
+ "description": "Whether enable tags sort.",
+ "type": "boolean",
+ "default": true
+ },
+ "order": {
+ "description": "Specify the order of tags, the other tags will be sorted by name.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "default": [],
+ "examples": [
+ [
+ "json",
+ "yaml",
+ "yml",
+ "toml",
+ "mapstructure",
+ "binding",
+ "validate"
+ ]
+ ]
+ },
+ "strict": {
+ "description": "Whether enable strict style.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "tagliatelle": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "case": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "use-field-name": {
+ "description": "Use the struct field name to check the name of the struct tag.",
+ "type": "boolean",
+ "default": false
+ },
+ "rules": {
+ "type": "object",
+ "patternProperties": {
+ "^.+$": {
+ "enum": [
+ "camel",
+ "pascal",
+ "kebab",
+ "snake",
+ "goCamel",
+ "goPascal",
+ "goKebab",
+ "goSnake",
+ "upper",
+ "upperSnake",
+ "lower",
+ "header"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "tenv": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "all": {
+ "description": "The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "testifylint": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "enable-all": {
+ "description": "Enable all checkers.",
+ "type": "boolean",
+ "default": false
+ },
+ "disable-all": {
+ "description": "Disable all checkers.",
+ "type": "boolean",
+ "default": false
+ },
+ "enable": {
+ "description": "Enable specific checkers.",
+ "type": "array",
+ "items": {
+ "enum": [
+ "blank-import",
+ "bool-compare",
+ "compares",
+ "empty",
+ "error-is-as",
+ "error-nil",
+ "expected-actual",
+ "float-compare",
+ "go-require",
+ "len",
+ "negative-positive",
+ "nil-compare",
+ "require-error",
+ "suite-dont-use-pkg",
+ "suite-extra-assert-call",
+ "suite-thelper",
+ "useless-assert"
+ ]
+ },
+ "default": [
+ "blank-import",
+ "bool-compare",
+ "compares",
+ "empty",
+ "error-is-as",
+ "error-nil",
+ "expected-actual",
+ "float-compare",
+ "go-require",
+ "len",
+ "negative-positive",
+ "nil-compare",
+ "require-error",
+ "suite-dont-use-pkg",
+ "suite-extra-assert-call",
+ "useless-assert"
+ ]
+ },
+ "disable": {
+ "description": "Disable specific checkers.",
+ "type": "array",
+ "items": {
+ "enum": [
+ "blank-import",
+ "bool-compare",
+ "compares",
+ "empty",
+ "error-is-as",
+ "error-nil",
+ "expected-actual",
+ "float-compare",
+ "go-require",
+ "len",
+ "negative-positive",
+ "nil-compare",
+ "require-error",
+ "suite-dont-use-pkg",
+ "suite-extra-assert-call",
+ "suite-thelper",
+ "useless-assert"
+ ],
+ "default": [
+ "suite-thelper"
+ ]
+ }
+ },
+ "bool-compare": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "ignore-custom-types": {
+ "description": "To ignore user defined types (over builtin bool).",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "expected-actual": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "pattern": {
+ "description": "Regexp for expected variable name.",
+ "type": "string",
+ "default": "(^(exp(ected)?|want(ed)?)([A-Z]\\w*)?$)|(^(\\w*[a-z])?(Exp(ected)?|Want(ed)?)$)"
+ }
+ }
+ },
+ "go-require": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "ignore-http-handlers": {
+ "description": "To ignore HTTP handlers (like http.HandlerFunc).",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "require-error": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "fn-pattern": {
+ "description": "Regexp for assertions to analyze. If defined, then only matched error assertions will be reported.",
+ "type": "string",
+ "default": ""
+ }
+ }
+ },
+ "suite-extra-assert-call": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "mode": {
+ "description": "To require or remove extra Assert() call?",
+ "type": "string",
+ "enum": ["remove", "require"],
+ "default": "remove"
+ }
+ }
+ }
+ }
+ },
+ "testpackage": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "skip-regexp": {
+ "description": "Files with names matching this regular expression are skipped.",
+ "type": "string",
+ "examples": ["(export|internal)_test\\.go"]
+ },
+ "allow-packages": {
+ "description": "List of packages that don't end with _test that tests are allowed to be in.",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "string",
+ "examples": ["example"]
+ }
+ }
+ }
+ },
+ "thelper": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "test": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "begin": {
+ "description": "Check if `t.Helper()` begins helper function.",
+ "default": true,
+ "type": "boolean"
+ },
+ "first": {
+ "description": "Check if *testing.T is first param of helper function.",
+ "default": true,
+ "type": "boolean"
+ },
+ "name": {
+ "description": "Check if *testing.T param has t name.",
+ "default": true,
+ "type": "boolean"
+ }
+ }
+ },
+ "benchmark": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "begin": {
+ "description": "Check if `b.Helper()` begins helper function.",
+ "default": true,
+ "type": "boolean"
+ },
+ "first": {
+ "description": "Check if *testing.B is first param of helper function.",
+ "default": true,
+ "type": "boolean"
+ },
+ "name": {
+ "description": "Check if *testing.B param has b name.",
+ "default": true,
+ "type": "boolean"
+ }
+ }
+ },
+ "tb": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "begin": {
+ "description": "Check if `tb.Helper()` begins helper function.",
+ "default": true,
+ "type": "boolean"
+ },
+ "first": {
+ "description": "Check if *testing.TB is first param of helper function.",
+ "default": true,
+ "type": "boolean"
+ },
+ "name": {
+ "description": "Check if *testing.TB param has tb name.",
+ "default": true,
+ "type": "boolean"
+ }
+ }
+ },
+ "fuzz": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "begin": {
+ "description": "Check if `f.Helper()` begins helper function.",
+ "default": true,
+ "type": "boolean"
+ },
+ "first": {
+ "description": "Check if *testing.F is first param of helper function.",
+ "default": true,
+ "type": "boolean"
+ },
+ "name": {
+ "description": "Check if *testing.F param has f name.",
+ "default": true,
+ "type": "boolean"
+ }
+ }
+ }
+ }
+ },
+ "usestdlibvars": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "http-method": {
+ "description": "Suggest the use of http.MethodXX.",
+ "type": "boolean",
+ "default": true
+ },
+ "http-status-code": {
+ "description": "Suggest the use of http.StatusXX.",
+ "type": "boolean",
+ "default": true
+ },
+ "time-weekday": {
+ "description": "Suggest the use of time.Weekday.String().",
+ "type": "boolean",
+ "default": false
+ },
+ "time-month": {
+ "description": "Suggest the use of time.Month.String().",
+ "type": "boolean",
+ "default": false
+ },
+ "time-layout": {
+ "description": "Suggest the use of time.Layout.",
+ "type": "boolean",
+ "default": false
+ },
+ "crypto-hash": {
+ "description": "Suggest the use of crypto.Hash.String().",
+ "type": "boolean",
+ "default": false
+ },
+ "default-rpc-path": {
+ "description": "Suggest the use of rpc.DefaultXXPath.",
+ "type": "boolean",
+ "default": false
+ },
+ "sql-isolation-level": {
+ "description": "Suggest the use of sql.LevelXX.String().",
+ "type": "boolean",
+ "default": false
+ },
+ "tls-signature-scheme": {
+ "description": "Suggest the use of tls.SignatureScheme.String().",
+ "type": "boolean",
+ "default": false
+ },
+ "constant-kind": {
+ "description": "Suggest the use of constant.Kind.String().",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "unconvert": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "fast-math": {
+ "type": "boolean",
+ "default": false
+ },
+ "safe": {
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "unparam": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "check-exported": {
+ "description": "Inspect exported functions. Set to true if no external program/library imports your code.\n\nWARNING: if you enable this setting, unparam will report a lot of false-positives in text editors:\nif it's called for subdir of a project it can't find external interfaces. All text editor integrations\nwith golangci-lint call it on a directory with the changed file.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "unused": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "field-writes-are-uses": {
+ "description": "",
+ "type": "boolean",
+ "default": true
+ },
+ "post-statements-are-reads": {
+ "description": "",
+ "type": "boolean",
+ "default": false
+ },
+ "exported-is-used": {
+ "description": "",
+ "type": "boolean",
+ "default": true
+ },
+ "exported-fields-are-used": {
+ "description": "",
+ "type": "boolean",
+ "default": true
+ },
+ "parameters-are-used": {
+ "description": "",
+ "type": "boolean",
+ "default": true
+ },
+ "local-variables-are-used": {
+ "description": "",
+ "type": "boolean",
+ "default": true
+ },
+ "generated-is-used": {
+ "description": "",
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "varnamelen": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "max-distance": {
+ "description": "Variables used in at most this N-many lines will be ignored.",
+ "type": "integer",
+ "default": 5
+ },
+ "min-name-length": {
+ "description": "The minimum length of a variable's name that is considered `long`.",
+ "type": "integer",
+ "default": 3
+ },
+ "check-receiver": {
+ "description": "Check method receiver names.",
+ "default": false,
+ "type": "boolean"
+ },
+ "check-return": {
+ "description": "Check named return values.",
+ "default": false,
+ "type": "boolean"
+ },
+ "check-type-param": {
+ "description": "Check type parameters.",
+ "default": false,
+ "type": "boolean"
+ },
+ "ignore-type-assert-ok": {
+ "description": "Ignore `ok` variables that hold the bool return value of a type assertion",
+ "default": false,
+ "type": "boolean"
+ },
+ "ignore-map-index-ok": {
+ "description": "Ignore `ok` variables that hold the bool return value of a map index.",
+ "default": false,
+ "type": "boolean"
+ },
+ "ignore-chan-recv-ok": {
+ "description": "Ignore `ok` variables that hold the bool return value of a channel receive.",
+ "default": false,
+ "type": "boolean"
+ },
+ "ignore-names": {
+ "description": "Optional list of variable names that should be ignored completely.",
+ "default": [[]],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ignore-decls": {
+ "description": "Optional list of variable declarations that should be ignored completely.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "examples": [
+ ["c echo.Context", "t testing.T", "f *foo.Bar", "const C"]
+ ]
+ }
+ }
+ },
+ "whitespace": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "multi-if": {
+ "description": "Enforces newlines (or comments) after every multi-line if statement",
+ "type": "boolean",
+ "default": false
+ },
+ "multi-func": {
+ "description": "Enforces newlines (or comments) after every multi-line function signature",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "wrapcheck": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "ignoreSigs": {
+ "description": "An array of strings which specify substrings of signatures to ignore.",
+ "default": [
+ ".Errorf(",
+ "errors.New(",
+ "errors.Unwrap(",
+ ".Wrap(",
+ ".Wrapf(",
+ ".WithMessage(",
+ ".WithMessagef(",
+ ".WithStack("
+ ],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ignoreSigRegexps": {
+ "description": "An array of strings which specify regular expressions of signatures to ignore.",
+ "default": [""],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ignorePackageGlobs": {
+ "description": "An array of glob patterns which, if any match the package of the function returning the error, will skip wrapcheck analysis for this error.",
+ "default": [""],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ignoreInterfaceRegexps": {
+ "description": "An array of glob patterns which, if matched to an underlying interface name, will ignore unwrapped errors returned from a function whose call is defined on the given interface.",
+ "default": [""],
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "wsl": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "allow-assign-and-anything": {
+ "description": "Controls if you may cuddle assignments and anything without needing an empty line between them.",
+ "type": "boolean",
+ "default": false
+ },
+ "allow-assign-and-call": {
+ "description": "Allow calls and assignments to be cuddled as long as the lines have any matching variables, fields or types.",
+ "type": "boolean",
+ "default": true
+ },
+ "allow-cuddle-declarations": {
+ "description": "Allow declarations (var) to be cuddled.",
+ "type": "boolean",
+ "default": false
+ },
+ "allow-cuddle-with-calls": {
+ "description": "A list of call idents that everything can be cuddled with.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "allow-cuddle-with-rhs": {
+ "description": "AllowCuddleWithRHS is a list of right hand side variables that is allowed to be cuddled with anything.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "allow-multiline-assign": {
+ "description": "Allow multiline assignments to be cuddled.",
+ "type": "boolean",
+ "default": true
+ },
+ "allow-separated-leading-comment": {
+ "description": "Allow leading comments to be separated with empty lines.",
+ "type": "boolean",
+ "default": false
+ },
+ "allow-trailing-comment": {
+ "description": "Allow trailing comments in ending of blocks.",
+ "type": "boolean",
+ "default": false
+ },
+ "error-variable-names": {
+ "description": "When force-err-cuddling is enabled this is a list of names used for error variables to check for in the conditional.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "force-case-trailing-whitespace": {
+ "description": "Force newlines in end of case at this limit (0 = never).",
+ "type": "integer",
+ "minimum": 0,
+ "default": 0
+ },
+ "force-err-cuddling": {
+ "description": "Causes an error when an If statement that checks an error variable doesn't cuddle with the assignment of that variable.",
+ "type": "boolean",
+ "default": false
+ },
+ "force-short-decl-cuddling": {
+ "description": "Causes an error if a short declaration (:=) cuddles with anything other than another short declaration.",
+ "type": "boolean",
+ "default": false
+ },
+ "strict-append": {
+ "description": "If true, append is only allowed to be cuddled if appending value is matching variables, fields or types on line above.",
+ "type": "boolean",
+ "default": true
+ }
+ }
+ },
+ "copyloopvar": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "check-alias": {
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "custom": {
+ "description": "The custom section can be used to define linter plugins to be loaded at runtime. See README of golangci-lint for more information.\nEach custom linter should have a unique name.",
+ "type": "object",
+ "patternProperties": {
+ "^.*$": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "type": {
+ "description": "The plugin type.",
+ "enum": ["module", "goplugin"],
+ "default": "goplugin"
+ },
+ "path": {
+ "description": "The path to the plugin *.so. Can be absolute or local.",
+ "type": "string",
+ "examples": ["/path/to/example.so"]
+ },
+ "description": {
+ "description": "The description of the linter, for documentation purposes only.",
+ "type": "string"
+ },
+ "original-url": {
+ "description": "Intended to point to the repo location of the linter, for documentation purposes only.",
+ "type": "string"
+ },
+ "settings": {
+ "description": "Plugins settings/configuration. Only work with plugin based on `linterdb.PluginConstructor`.",
+ "type": "object"
+ }
+ },
+ "oneOf": [
+ {
+ "properties": {
+ "type": {"enum": ["module"] }
+ }
+ },
+ {
+ "required": ["path"]
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "linters": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "enable": {
+ "description": "List of enabled linters.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/linters"
+ }
+ },
+ "disable": {
+ "description": "List of disabled linters.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/linters"
+ }
+ },
+ "enable-all": {
+ "description": "Whether to enable all linters. You can re-disable them with `disable` explicitly.",
+ "type": "boolean",
+ "default": false
+ },
+ "disable-all": {
+ "description": "Whether to disable all linters. You can re-enable them with `enable` explicitly.",
+ "type": "boolean",
+ "default": false
+ },
+ "presets": {
+ "description": "Allow to use different presets of linters",
+ "type": "array",
+ "items": {
+ "enum": [
+ "bugs",
+ "comment",
+ "complexity",
+ "error",
+ "format",
+ "import",
+ "metalinter",
+ "module",
+ "performance",
+ "sql",
+ "style",
+ "test",
+ "unused"
+ ]
+ }
+ },
+ "fast": {
+ "description": "Enable run of fast linters.",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "issues": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "exclude": {
+ "description": "List of regular expressions of issue texts to exclude.\nBut independently from this option we use default exclude patterns. Their usage can be controlled through `exclude-use-default`.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "exclude-rules": {
+ "description": "Exclude configuration per-path, per-linter, per-text and per-source",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "path": {
+ "type": "string"
+ },
+ "path-except": {
+ "type": "string"
+ },
+ "linters": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/linters"
+ }
+ },
+ "text": {
+ "type": "string"
+ },
+ "source": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "exclude-use-default": {
+ "description": "Independently from option `exclude` we use default exclude patterns. This behavior can be disabled by this option.",
+ "type": "boolean",
+ "default": true
+ },
+ "exclude-case-sensitive": {
+ "description": "If set to true, exclude and exclude-rules regular expressions become case sensitive.",
+ "type": "boolean",
+ "default": false
+ },
+ "exclude-generated": {
+ "description": "Mode of the generated files analysis.",
+ "enum": ["lax", "strict", "disable"],
+ "default": "lax"
+ },
+ "exclude-dirs": {
+ "description": "Which directories to exclude: issues from them won't be reported.",
+ "type": "array",
+ "items": {
+ "description": "You can use regexp here. The regexp is applied on the full path.\n\"/\" will be replaced by current OS file path separator to properly work on Windows.",
+ "type": "string",
+ "examples": ["generated.*"]
+ },
+ "default": [],
+ "examples": [["src/external_libs", "autogenerated_by_my_lib"]]
+ },
+ "exclude-dirs-use-default": {
+ "description": "Enable exclusion of directories \"vendor\", \"third_party\", \"testdata\", \"examples\", \"Godeps\", and \"builtin\".",
+ "type": "boolean",
+ "default": true
+ },
+ "exclude-files": {
+ "description": "Which files to exclude: they will be analyzed, but issues from them will not be reported.",
+ "type": "array",
+ "items": {
+ "description": "You can use regexp here. There is no need to include all autogenerated files, we confidently recognize them. If that is not the case, please let us know.\n\"/\" will be replaced by current OS file path separator to properly work on Windows.",
+ "type": "string",
+ "examples": [".*\\.my\\.go$"]
+ },
+ "default": [],
+ "examples": [[".*\\.my\\.go$", "lib/bad.go"]]
+ },
+ "include": {
+ "description": "The list of ids of default excludes to include or disable.",
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "default": []
+ },
+ "max-issues-per-linter": {
+ "description": "Maximum issues count per one linter. Set to 0 to disable.",
+ "type": "integer",
+ "default": 50,
+ "minimum": 0
+ },
+ "max-same-issues": {
+ "description": "Maximum count of issues with the same text. Set to 0 to disable.",
+ "type": "integer",
+ "default": 3,
+ "minimum": 0
+ },
+ "new": {
+ "description": "Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.",
+ "type": "boolean",
+ "default": false
+ },
+ "new-from-rev": {
+ "description": "Show only new issues created after this git revision.",
+ "type": "string"
+ },
+ "new-from-patch": {
+ "description": "Show only new issues created in git patch with this file path.",
+ "type": "string",
+ "examples": ["path/to/patch/file"]
+ },
+ "fix": {
+ "description": "Fix found issues (if it's supported by the linter).",
+ "type": "boolean",
+ "default": false
+ },
+ "whole-files": {
+ "description": "Show issues in any part of update files (requires new-from-rev or new-from-patch).",
+ "type": "boolean",
+ "default": false
+ }
+ }
+ },
+ "severity": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "default-severity": {
+ "description": "Set the default severity for issues. If severity rules are defined and the issues do not match or no severity is provided to the rule this will be the default severity applied. Severities should match the supported severity names of the selected out format.",
+ "type": "string",
+ "default": ""
+ },
+ "case-sensitive": {
+ "description": "If set to true, severity-rules regular expressions become case sensitive.",
+ "type": "boolean",
+ "default": false
+ },
+ "rules": {
+ "description": "When a list of severity rules are provided, severity information will be added to lint issues. Severity rules have the same filtering capability as exclude rules except you are allowed to specify one matcher per severity rule.\nOnly affects out formats that support setting severity information.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "severity": {
+ "type": "string"
+ },
+ "path": {
+ "type": "string"
+ },
+ "path-except": {
+ "type": "string"
+ },
+ "linters": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/linters"
+ }
+ },
+ "text": {
+ "type": "string"
+ },
+ "source": {
+ "type": "string"
+ }
+ },
+ "required": ["severity"],
+ "anyOf": [
+ { "required": ["path"] },
+ { "required": ["path-except"] },
+ { "required": ["linters"] },
+ { "required": ["text"] },
+ { "required": ["source"] }
+ ]
+ },
+ "default": []
+ }
+ },
+ "required": ["default-severity"]
+ }
+ }
+}
diff --git a/pkg/commands/config_verify.go b/pkg/commands/config_verify.go
index a44050b593b3..89017e9bfc07 100644
--- a/pkg/commands/config_verify.go
+++ b/pkg/commands/config_verify.go
@@ -140,7 +140,6 @@ func printValidationDetail(cmd *cobra.Command, detail *jsonschema.Detailed) {
}
for _, d := range detail.Errors {
- d := d
printValidationDetail(cmd, &d)
}
}
diff --git a/pkg/commands/config_verify_test.go b/pkg/commands/config_verify_test.go
index 81d16e283298..cf62e2f9772e 100644
--- a/pkg/commands/config_verify_test.go
+++ b/pkg/commands/config_verify_test.go
@@ -63,7 +63,6 @@ func Test_createSchemaURL(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -126,7 +125,6 @@ func Test_createSchemaURL_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/commands/internal/builder_test.go b/pkg/commands/internal/builder_test.go
index 508755cf2271..99a1cad0e0c1 100644
--- a/pkg/commands/internal/builder_test.go
+++ b/pkg/commands/internal/builder_test.go
@@ -45,7 +45,6 @@ func Test_sanitizeVersion(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/commands/internal/configuration_test.go b/pkg/commands/internal/configuration_test.go
index 3c85a9075f52..915564e1b0d7 100644
--- a/pkg/commands/internal/configuration_test.go
+++ b/pkg/commands/internal/configuration_test.go
@@ -41,7 +41,6 @@ func TestConfiguration_Validate(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -115,7 +114,6 @@ func TestConfiguration_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go
index 0fe1855cc19e..e56e6f775d91 100644
--- a/pkg/config/config_test.go
+++ b/pkg/config/config_test.go
@@ -76,7 +76,6 @@ func TestIsGoGreaterThanOrEqual(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -124,7 +123,6 @@ func Test_trimGoVersion(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/config/issues_test.go b/pkg/config/issues_test.go
index 9d590ea85e57..8470fad6ba58 100644
--- a/pkg/config/issues_test.go
+++ b/pkg/config/issues_test.go
@@ -121,7 +121,6 @@ func TestExcludeRule_Validate(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -194,7 +193,6 @@ func TestExcludeRule_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/config/linters_settings_test.go b/pkg/config/linters_settings_test.go
index 1fd77d2e2215..6eed1bed450c 100644
--- a/pkg/config/linters_settings_test.go
+++ b/pkg/config/linters_settings_test.go
@@ -33,7 +33,6 @@ func TestLintersSettings_Validate(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -74,7 +73,6 @@ func TestLintersSettings_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -112,7 +110,6 @@ func TestCustomLinterSettings_Validate(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -144,7 +141,6 @@ func TestCustomLinterSettings_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -181,7 +177,6 @@ func TestGovetSettings_Validate(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -224,7 +219,6 @@ func TestGovetSettings_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/config/linters_test.go b/pkg/config/linters_test.go
index 5be75600541f..7b01ebee60da 100644
--- a/pkg/config/linters_test.go
+++ b/pkg/config/linters_test.go
@@ -42,7 +42,6 @@ func TestLinters_validateDisabledAndEnabledAtOneMoment(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -77,7 +76,6 @@ func TestLinters_validateDisabledAndEnabledAtOneMoment_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -138,7 +136,6 @@ func TestLinters_validateAllDisableEnableOptions(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -201,7 +198,6 @@ func TestLinters_validateAllDisableEnableOptions_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/config/output_test.go b/pkg/config/output_test.go
index d56342defb48..0379cfc44b76 100644
--- a/pkg/config/output_test.go
+++ b/pkg/config/output_test.go
@@ -42,7 +42,6 @@ func TestOutput_Validate(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -95,7 +94,6 @@ func TestOutput_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -133,7 +131,6 @@ func TestOutputFormat_Validate(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -164,7 +161,6 @@ func TestOutputFormat_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/config/run_test.go b/pkg/config/run_test.go
index 7d08509ce0ab..0cf283a1ef81 100644
--- a/pkg/config/run_test.go
+++ b/pkg/config/run_test.go
@@ -38,7 +38,6 @@ func TestRun_Validate(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -64,7 +63,6 @@ func TestRun_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/config/severity_test.go b/pkg/config/severity_test.go
index 049fd1663a8b..56dab604c93c 100644
--- a/pkg/config/severity_test.go
+++ b/pkg/config/severity_test.go
@@ -48,7 +48,6 @@ func TestSeverity_Validate(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -96,7 +95,6 @@ func TestSeverity_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -194,7 +192,6 @@ func TestSeverityRule_Validate_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/goanalysis/pkgerrors/errors.go b/pkg/goanalysis/pkgerrors/errors.go
index 91f6dd39d755..7da659e80376 100644
--- a/pkg/goanalysis/pkgerrors/errors.go
+++ b/pkg/goanalysis/pkgerrors/errors.go
@@ -25,8 +25,6 @@ func BuildIssuesFromIllTypedError(errs []error, lintCtx *linter.Context) ([]resu
var other error
for _, err := range errs {
- err := err
-
var ill *IllTypedError
if !errors.As(err, &ill) {
if other == nil {
diff --git a/pkg/goanalysis/pkgerrors/extract_test.go b/pkg/goanalysis/pkgerrors/extract_test.go
index 1e014ea45e8e..02c801e0b106 100644
--- a/pkg/goanalysis/pkgerrors/extract_test.go
+++ b/pkg/goanalysis/pkgerrors/extract_test.go
@@ -40,7 +40,6 @@ func Test_stackCrusher(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/goanalysis/runner_loadingpackage.go b/pkg/goanalysis/runner_loadingpackage.go
index c54357eb6794..f0ffd4cb10fa 100644
--- a/pkg/goanalysis/runner_loadingpackage.go
+++ b/pkg/goanalysis/runner_loadingpackage.go
@@ -9,6 +9,8 @@ import (
"go/types"
"os"
"reflect"
+ "runtime"
+ "strings"
"sync"
"sync/atomic"
@@ -150,12 +152,15 @@ func (lp *loadingPackage) loadFromSource(loadMode LoadMode) error {
}
return imp.Types, nil
}
+
tc := &types.Config{
Importer: importerFunc(importer),
Error: func(err error) {
pkg.Errors = append(pkg.Errors, lp.convertError(err)...)
},
+ GoVersion: getGoVersion(),
}
+
_ = types.NewChecker(tc, pkg.Fset, pkg.Types, pkg.TypesInfo).Files(pkg.Syntax)
// Don't handle error here: errors are adding by tc.Error function.
@@ -470,7 +475,7 @@ func sizeOfReflectValueTreeBytes(rv reflect.Value, visitedPtrs map[uintptr]struc
return sizeOfReflectValueTreeBytes(rv.Elem(), visitedPtrs)
case reflect.Struct:
ret := 0
- for i := 0; i < rv.NumField(); i++ {
+ for i := range rv.NumField() {
ret += sizeOfReflectValueTreeBytes(rv.Field(i), visitedPtrs)
}
return ret
@@ -497,3 +502,17 @@ func sizeOfReflectValueTreeBytes(rv reflect.Value, visitedPtrs map[uintptr]struc
panic("unknown rv of type " + rv.String())
}
}
+
+// TODO(ldez) temporary workaround
+func getGoVersion() string {
+ goVersion := runtime.Version()
+
+ parts := strings.Fields(goVersion)
+
+ if len(parts) == 0 {
+ return goVersion
+ }
+
+ // When using GOEXPERIMENT, the version returned might look something like "go1.23.0 X:boringcrypto".
+ return parts[0]
+}
diff --git a/pkg/goanalysis/runners.go b/pkg/goanalysis/runners.go
index c02d33b79757..79e52f52a3e0 100644
--- a/pkg/goanalysis/runners.go
+++ b/pkg/goanalysis/runners.go
@@ -134,7 +134,7 @@ func saveIssuesToCache(allPkgs []*packages.Package, pkgsFromCache map[*packages.
perPkgIssues[i.Pkg] = append(perPkgIssues[i.Pkg], *i)
}
- savedIssuesCount := int32(0)
+ var savedIssuesCount int64 = 0
lintResKey := getIssuesCacheKey(analyzers)
workerCount := runtime.GOMAXPROCS(-1)
@@ -162,7 +162,7 @@ func saveIssuesToCache(allPkgs []*packages.Package, pkgsFromCache map[*packages.
})
}
- atomic.AddInt32(&savedIssuesCount, int32(len(encodedIssues)))
+ atomic.AddInt64(&savedIssuesCount, int64(len(encodedIssues)))
if err := lintCtx.PkgCache.Put(pkg, pkgcache.HashModeNeedAllDeps, lintResKey, encodedIssues); err != nil {
lintCtx.Log.Infof("Failed to save package %s issues (%d) to cache: %s", pkg, len(pkgIssues), err)
} else {
@@ -205,7 +205,7 @@ func loadIssuesFromCache(pkgs []*packages.Package, lintCtx *linter.Context,
wg.Add(workerCount)
pkgCh := make(chan *packages.Package, len(pkgs))
- for i := 0; i < workerCount; i++ {
+ for range workerCount {
go func() {
defer wg.Done()
for pkg := range pkgCh {
diff --git a/pkg/golinters/gocritic/gocritic_test.go b/pkg/golinters/gocritic/gocritic_test.go
index 2a8d6088ead0..3fbcfef023a4 100644
--- a/pkg/golinters/gocritic/gocritic_test.go
+++ b/pkg/golinters/gocritic/gocritic_test.go
@@ -262,7 +262,6 @@ func Test_settingsWrapper_InferEnabledChecks(t *testing.T) {
}
for _, tt := range cases {
- tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
@@ -434,7 +433,6 @@ func Test_settingsWrapper_Validate(t *testing.T) {
}
for _, tt := range cases {
- tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/golinters/gofumpt/gofumpt.go b/pkg/golinters/gofumpt/gofumpt.go
index 9a0bef84aa15..3bb7df12e2b4 100644
--- a/pkg/golinters/gofumpt/gofumpt.go
+++ b/pkg/golinters/gofumpt/gofumpt.go
@@ -5,6 +5,7 @@ import (
"fmt"
"io"
"os"
+ "strings"
"sync"
"github.com/shazow/go-diff/difflib"
@@ -113,10 +114,11 @@ func runGofumpt(lintCtx *linter.Context, pass *analysis.Pass, diff differ, optio
func getLangVersion(settings *config.GofumptSettings) string {
if settings == nil || settings.LangVersion == "" {
- // TODO: defaults to "1.15", in the future (v2) must be set by using build.Default.ReleaseTags like staticcheck.
- return "1.15"
+ // TODO: defaults to "1.15", in the future (v2) must be removed.
+ return "go1.15"
}
- return settings.LangVersion
+
+ return "go" + strings.TrimPrefix(settings.LangVersion, "go")
}
func getIssuedTextGoFumpt(settings *config.LintersSettings) string {
diff --git a/pkg/golinters/gosec/gosec.go b/pkg/golinters/gosec/gosec.go
index c333152e69c6..3e362d729375 100644
--- a/pkg/golinters/gosec/gosec.go
+++ b/pkg/golinters/gosec/gosec.go
@@ -10,6 +10,7 @@ import (
"sync"
"github.com/securego/gosec/v2"
+ "github.com/securego/gosec/v2/analyzers"
"github.com/securego/gosec/v2/issue"
"github.com/securego/gosec/v2/rules"
"golang.org/x/tools/go/analysis"
@@ -27,16 +28,20 @@ func New(settings *config.GoSecSettings) *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
- var filters []rules.RuleFilter
conf := gosec.NewConfig()
+
+ var ruleFilters []rules.RuleFilter
+ var analyzerFilters []analyzers.AnalyzerFilter
if settings != nil {
- filters = gosecRuleFilters(settings.Includes, settings.Excludes)
+ ruleFilters = createRuleFilters(settings.Includes, settings.Excludes)
+ analyzerFilters = createAnalyzerFilters(settings.Includes, settings.Excludes)
conf = toGosecConfig(settings)
}
logger := log.New(io.Discard, "", 0)
- ruleDefinitions := rules.Generate(false, filters...)
+ ruleDefinitions := rules.Generate(false, ruleFilters...)
+ analyzerDefinitions := analyzers.Generate(false, analyzerFilters...)
analyzer := &analysis.Analyzer{
Name: linterName,
@@ -53,7 +58,9 @@ func New(settings *config.GoSecSettings) *goanalysis.Linter {
analyzer.Run = func(pass *analysis.Pass) (any, error) {
// The `gosecAnalyzer` is here because of concurrency issue.
gosecAnalyzer := gosec.NewAnalyzer(conf, true, settings.ExcludeGenerated, false, settings.Concurrency, logger)
+
gosecAnalyzer.LoadRules(ruleDefinitions.RulesInfo())
+ gosecAnalyzer.LoadAnalyzers(analyzerDefinitions.AnalyzersInfo())
issues := runGoSec(lintCtx, pass, settings, gosecAnalyzer)
@@ -77,6 +84,7 @@ func runGoSec(lintCtx *linter.Context, pass *analysis.Pass, settings *config.GoS
}
analyzer.CheckRules(pkg)
+ analyzer.CheckAnalyzers(pkg)
secIssues, _, _ := analyzer.Report()
if len(secIssues) == 0 {
@@ -175,8 +183,23 @@ func convertGosecGlobals(globalOptionFromConfig any, conf gosec.Config) {
}
}
+// based on https://github.com/securego/gosec/blob/81cda2f91fbe1bf4735feb55febcae03e697a92b/cmd/gosec/main.go#L258-L275
+func createAnalyzerFilters(includes, excludes []string) []analyzers.AnalyzerFilter {
+ var filters []analyzers.AnalyzerFilter
+
+ if len(includes) > 0 {
+ filters = append(filters, analyzers.NewAnalyzerFilter(false, includes...))
+ }
+
+ if len(excludes) > 0 {
+ filters = append(filters, analyzers.NewAnalyzerFilter(true, excludes...))
+ }
+
+ return filters
+}
+
// based on https://github.com/securego/gosec/blob/569328eade2ccbad4ce2d0f21ee158ab5356a5cf/cmd/gosec/main.go#L170-L188
-func gosecRuleFilters(includes, excludes []string) []rules.RuleFilter {
+func createRuleFilters(includes, excludes []string) []rules.RuleFilter {
var filters []rules.RuleFilter
if len(includes) > 0 {
diff --git a/pkg/golinters/gosec/gosec_test.go b/pkg/golinters/gosec/gosec_test.go
index e8d6187e350d..5535339a7c0b 100644
--- a/pkg/golinters/gosec/gosec_test.go
+++ b/pkg/golinters/gosec/gosec_test.go
@@ -58,7 +58,6 @@ func Test_toGosecConfig(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/golinters/gosimple/gosimple.go b/pkg/golinters/gosimple/gosimple.go
index 6a0d967232ab..c03871adf9b5 100644
--- a/pkg/golinters/gosimple/gosimple.go
+++ b/pkg/golinters/gosimple/gosimple.go
@@ -11,7 +11,7 @@ import (
func New(settings *config.StaticCheckSettings) *goanalysis.Linter {
cfg := internal.StaticCheckConfig(settings)
- analyzers := internal.SetupStaticCheckAnalyzers(simple.Analyzers, internal.GetGoVersion(settings), cfg.Checks)
+ analyzers := internal.SetupStaticCheckAnalyzers(simple.Analyzers, cfg.Checks)
return goanalysis.NewLinter(
"gosimple",
diff --git a/pkg/golinters/internal/diff.go b/pkg/golinters/internal/diff.go
index b20230dfa9cf..f919c5b2a8f2 100644
--- a/pkg/golinters/internal/diff.go
+++ b/pkg/golinters/internal/diff.go
@@ -242,7 +242,6 @@ func ExtractIssuesFromPatch(patch string, lintCtx *linter.Context, linterName st
changes := p.parse(hunk)
for _, change := range changes {
- change := change // fix scope
i := result.Issue{
FromLinter: linterName,
Pos: token.Position{
diff --git a/pkg/golinters/internal/staticcheck_common.go b/pkg/golinters/internal/staticcheck_common.go
index 5b5812c318a2..958013d0df2c 100644
--- a/pkg/golinters/internal/staticcheck_common.go
+++ b/pkg/golinters/internal/staticcheck_common.go
@@ -14,20 +14,7 @@ import (
var debugf = logutils.Debug(logutils.DebugKeyMegacheck)
-func GetGoVersion(settings *config.StaticCheckSettings) string {
- var goVersion string
- if settings != nil {
- goVersion = settings.GoVersion
- }
-
- if goVersion != "" {
- return goVersion
- }
-
- return "1.17"
-}
-
-func SetupStaticCheckAnalyzers(src []*lint.Analyzer, goVersion string, checks []string) []*analysis.Analyzer {
+func SetupStaticCheckAnalyzers(src []*lint.Analyzer, checks []string) []*analysis.Analyzer {
var names []string
for _, a := range src {
names = append(names, a.Analyzer.Name)
@@ -38,7 +25,6 @@ func SetupStaticCheckAnalyzers(src []*lint.Analyzer, goVersion string, checks []
var ret []*analysis.Analyzer
for _, a := range src {
if filter[a.Analyzer.Name] {
- SetAnalyzerGoVersion(a.Analyzer, goVersion)
ret = append(ret, a.Analyzer)
}
}
diff --git a/pkg/golinters/misspell/misspell_test.go b/pkg/golinters/misspell/misspell_test.go
index 3766d1799224..33cd2ad82004 100644
--- a/pkg/golinters/misspell/misspell_test.go
+++ b/pkg/golinters/misspell/misspell_test.go
@@ -81,7 +81,6 @@ func Test_appendExtraWords_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/golinters/nolintlint/internal/nolintlint_test.go b/pkg/golinters/nolintlint/internal/nolintlint_test.go
index 1c6d7d89b03f..0fff159285bd 100644
--- a/pkg/golinters/nolintlint/internal/nolintlint_test.go
+++ b/pkg/golinters/nolintlint/internal/nolintlint_test.go
@@ -209,7 +209,6 @@ func foo() {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/golinters/spancheck/testdata/go.mod b/pkg/golinters/spancheck/testdata/go.mod
index de347098a901..f35f25df4589 100644
--- a/pkg/golinters/spancheck/testdata/go.mod
+++ b/pkg/golinters/spancheck/testdata/go.mod
@@ -1,6 +1,6 @@
module spancheck
-go 1.20
+go 1.21
require (
go.opentelemetry.io/otel v1.21.0
diff --git a/pkg/golinters/staticcheck/staticcheck.go b/pkg/golinters/staticcheck/staticcheck.go
index 0c0534539ea5..79394bdb7f8a 100644
--- a/pkg/golinters/staticcheck/staticcheck.go
+++ b/pkg/golinters/staticcheck/staticcheck.go
@@ -10,7 +10,7 @@ import (
func New(settings *config.StaticCheckSettings) *goanalysis.Linter {
cfg := internal.StaticCheckConfig(settings)
- analyzers := internal.SetupStaticCheckAnalyzers(staticcheck.Analyzers, internal.GetGoVersion(settings), cfg.Checks)
+ analyzers := internal.SetupStaticCheckAnalyzers(staticcheck.Analyzers, cfg.Checks)
return goanalysis.NewLinter(
"staticcheck",
diff --git a/pkg/golinters/stylecheck/stylecheck.go b/pkg/golinters/stylecheck/stylecheck.go
index b8fc8fe547d1..60859f28afc3 100644
--- a/pkg/golinters/stylecheck/stylecheck.go
+++ b/pkg/golinters/stylecheck/stylecheck.go
@@ -20,7 +20,7 @@ func New(settings *config.StaticCheckSettings) *goanalysis.Linter {
return cfg, nil
}
- analyzers := internal.SetupStaticCheckAnalyzers(stylecheck.Analyzers, internal.GetGoVersion(settings), cfg.Checks)
+ analyzers := internal.SetupStaticCheckAnalyzers(stylecheck.Analyzers, cfg.Checks)
return goanalysis.NewLinter(
"stylecheck",
diff --git a/pkg/golinters/thelper/testdata/thelper.go b/pkg/golinters/thelper/testdata/thelper.go
index 6458ab2dc4b8..fa6737a5a91f 100644
--- a/pkg/golinters/thelper/testdata/thelper.go
+++ b/pkg/golinters/thelper/testdata/thelper.go
@@ -52,7 +52,6 @@ func TestSubtestShouldNotBeChecked(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/golinters/unused/unused.go b/pkg/golinters/unused/unused.go
index 19cf7476fc03..7b2b478fc943 100644
--- a/pkg/golinters/unused/unused.go
+++ b/pkg/golinters/unused/unused.go
@@ -12,14 +12,13 @@ import (
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/goanalysis"
- "github.com/golangci/golangci-lint/pkg/golinters/internal"
"github.com/golangci/golangci-lint/pkg/lint/linter"
"github.com/golangci/golangci-lint/pkg/result"
)
const linterName = "unused"
-func New(settings *config.UnusedSettings, scSettings *config.StaticCheckSettings) *goanalysis.Linter {
+func New(settings *config.UnusedSettings) *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
@@ -41,8 +40,6 @@ func New(settings *config.UnusedSettings, scSettings *config.StaticCheckSettings
},
}
- internal.SetAnalyzerGoVersion(analyzer, internal.GetGoVersion(scSettings))
-
return goanalysis.NewLinter(
linterName,
"Checks Go code for unused constants, variables, functions and types",
diff --git a/pkg/lint/lintersdb/builder_linter.go b/pkg/lint/lintersdb/builder_linter.go
index 7b83a81530a7..2e6c148e329c 100644
--- a/pkg/lint/lintersdb/builder_linter.go
+++ b/pkg/lint/lintersdb/builder_linter.go
@@ -278,7 +278,8 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
WithSince("v1.28.0").
WithPresets(linter.PresetBugs).
WithLoadForGoAnalysis().
- WithURL("https://github.com/kyoh86/exportloopref"),
+ WithURL("https://github.com/kyoh86/exportloopref").
+ DeprecatedWarning("Since Go1.22 (loopvar) this linter is no longer relevant.", "v1.60.2", "copyloopvar"),
linter.NewConfig(forbidigo.New(&cfg.LintersSettings.Forbidigo)).
WithSince("v1.34.0").
@@ -774,7 +775,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
WithLoadForGoAnalysis().
WithURL("https://github.com/mvdan/unparam"),
- linter.NewConfig(unused.New(&cfg.LintersSettings.Unused, &cfg.LintersSettings.Staticcheck)).
+ linter.NewConfig(unused.New(&cfg.LintersSettings.Unused)).
WithEnabledByDefault().
WithSince("v1.20.0").
WithLoadForGoAnalysis().
diff --git a/pkg/lint/lintersdb/builder_plugin_go.go b/pkg/lint/lintersdb/builder_plugin_go.go
index c6dbaf79307d..88f3e2ae3992 100644
--- a/pkg/lint/lintersdb/builder_plugin_go.go
+++ b/pkg/lint/lintersdb/builder_plugin_go.go
@@ -43,8 +43,6 @@ func (b *PluginGoBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
continue
}
- settings := settings
-
lc, err := b.loadConfig(cfg, name, &settings)
if err != nil {
return nil, fmt.Errorf("unable to load custom analyzer %q: %s, %w", name, settings.Path, err)
diff --git a/pkg/lint/lintersdb/manager.go b/pkg/lint/lintersdb/manager.go
index 0a487be92e73..75ab53d7cfbb 100644
--- a/pkg/lint/lintersdb/manager.go
+++ b/pkg/lint/lintersdb/manager.go
@@ -162,7 +162,6 @@ func (m *Manager) build(enabledByDefaultLinters []*linter.Config) map[string]*li
// --presets can only add linters to default set
for _, p := range m.cfg.Linters.Presets {
for _, lc := range m.GetAllLinterConfigsForPreset(p) {
- lc := lc
resultLintersSet[lc.Name()] = lc
}
}
diff --git a/pkg/lint/lintersdb/manager_test.go b/pkg/lint/lintersdb/manager_test.go
index 227a0ca6a838..b3b6892443ea 100644
--- a/pkg/lint/lintersdb/manager_test.go
+++ b/pkg/lint/lintersdb/manager_test.go
@@ -149,7 +149,6 @@ func TestManager_build(t *testing.T) {
}
for _, c := range cases {
- c := c
t.Run(c.name, func(t *testing.T) {
m, err := NewManager(logutils.NewStderrLog("skip"), &config.Config{Linters: c.cfg}, NewLinterBuilder())
require.NoError(t, err)
@@ -304,7 +303,6 @@ func TestManager_combineGoAnalysisLinters(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/lint/lintersdb/validator_test.go b/pkg/lint/lintersdb/validator_test.go
index d9e36760860e..25e77e4490b0 100644
--- a/pkg/lint/lintersdb/validator_test.go
+++ b/pkg/lint/lintersdb/validator_test.go
@@ -118,7 +118,6 @@ func TestValidator_Validate(t *testing.T) {
testCases = append(testCases, validatePresetsTestCases...)
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -139,7 +138,6 @@ func TestValidator_Validate_error(t *testing.T) {
testCases = append(testCases, validatePresetsErrorTestCases...)
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -158,7 +156,6 @@ func TestValidator_validateLintersNames(t *testing.T) {
v := NewValidator(m)
for _, test := range validateLintersNamesTestCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -175,7 +172,6 @@ func TestValidator_validateLintersNames_error(t *testing.T) {
v := NewValidator(m)
for _, test := range validateLintersNamesErrorTestCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -191,7 +187,6 @@ func TestValidator_validatePresets(t *testing.T) {
v := NewValidator(nil)
for _, test := range validatePresetsTestCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -205,7 +200,6 @@ func TestValidator_validatePresets_error(t *testing.T) {
v := NewValidator(nil)
for _, test := range validatePresetsErrorTestCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/lint/package_test.go b/pkg/lint/package_test.go
index 19ed1dd52beb..02778146bde5 100644
--- a/pkg/lint/package_test.go
+++ b/pkg/lint/package_test.go
@@ -37,7 +37,6 @@ func Test_buildArgs(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/lint/runner.go b/pkg/lint/runner.go
index 379508ab08e4..c3b983ff6a4a 100644
--- a/pkg/lint/runner.go
+++ b/pkg/lint/runner.go
@@ -115,7 +115,6 @@ func (r *Runner) Run(ctx context.Context, linters []*linter.Config) ([]result.Is
)
for _, lc := range linters {
- lc := lc
sw.TrackStage(lc.Name(), func() {
linterIssues, err := r.runLinterSafe(ctx, r.lintCtx, lc)
if err != nil {
@@ -189,7 +188,6 @@ func (r *Runner) processLintResults(inIssues []result.Issue) []result.Issue {
// finalize processors: logging, clearing, no heavy work here
for _, p := range r.Processors {
- p := p
sw.TrackStage(p.Name(), func() {
p.Finish()
})
@@ -220,7 +218,6 @@ func (r *Runner) processIssues(issues []result.Issue, sw *timeutils.Stopwatch, s
for _, p := range r.Processors {
var newIssues []result.Issue
var err error
- p := p
sw.TrackStage(p.Name(), func() {
newIssues, err = p.Process(issues)
})
diff --git a/pkg/printers/printer_test.go b/pkg/printers/printer_test.go
index 2cb21bc7e837..56d0c6f92980 100644
--- a/pkg/printers/printer_test.go
+++ b/pkg/printers/printer_test.go
@@ -64,7 +64,6 @@ func TestPrinter_Print_stdout(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/printers/tab_test.go b/pkg/printers/tab_test.go
index 00e376ef06dc..fbd5dca6c65b 100644
--- a/pkg/printers/tab_test.go
+++ b/pkg/printers/tab_test.go
@@ -82,7 +82,6 @@ path/to/fileb.go:300:9 another issue
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/printers/text_test.go b/pkg/printers/text_test.go
index fe9c53098576..bec16f72618a 100644
--- a/pkg/printers/text_test.go
+++ b/pkg/printers/text_test.go
@@ -110,7 +110,6 @@ path/to/fileb.go:300:9: another issue
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/result/processors/autogenerated_exclude_test.go b/pkg/result/processors/autogenerated_exclude_test.go
index 4d5468d565e0..f0325560d697 100644
--- a/pkg/result/processors/autogenerated_exclude_test.go
+++ b/pkg/result/processors/autogenerated_exclude_test.go
@@ -45,7 +45,6 @@ func TestAutogeneratedExclude_isGeneratedFileLax_generated(t *testing.T) {
}
for _, comment := range comments {
- comment := comment
t.Run(comment, func(t *testing.T) {
t.Parallel()
@@ -64,7 +63,6 @@ func TestAutogeneratedExclude_isGeneratedFileLax_nonGenerated(t *testing.T) {
}
for _, comment := range comments {
- comment := comment
t.Run(comment, func(t *testing.T) {
t.Parallel()
@@ -95,7 +93,6 @@ func TestAutogeneratedExclude_isGeneratedFileStrict(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -183,7 +180,6 @@ func Test_shouldPassIssue(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -236,7 +232,6 @@ func Test_shouldPassIssue_error(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/result/processors/exclude_rules.go b/pkg/result/processors/exclude_rules.go
index b468c510137d..bf255ae82f50 100644
--- a/pkg/result/processors/exclude_rules.go
+++ b/pkg/result/processors/exclude_rules.go
@@ -64,7 +64,6 @@ func (p ExcludeRules) Process(issues []result.Issue) ([]result.Issue, error) {
return filterIssues(issues, func(issue *result.Issue) bool {
for _, rule := range p.rules {
- rule := rule
if rule.match(issue, p.files, p.log) {
return false
}
diff --git a/pkg/result/processors/invalid_issue_test.go b/pkg/result/processors/invalid_issue_test.go
index b0e45998041e..1af60cbf44c4 100644
--- a/pkg/result/processors/invalid_issue_test.go
+++ b/pkg/result/processors/invalid_issue_test.go
@@ -111,7 +111,6 @@ func TestInvalidIssue_Process(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/result/processors/nolint_test.go b/pkg/result/processors/nolint_test.go
index b075ef618361..afe1a286ff11 100644
--- a/pkg/result/processors/nolint_test.go
+++ b/pkg/result/processors/nolint_test.go
@@ -183,7 +183,6 @@ func TestNolintInvalidLinterNameWithViolationOnTheSameLine(t *testing.T) {
func TestNolintAliases(t *testing.T) {
p := newTestNolintProcessor(getMockLog())
for _, line := range []int{47, 49, 51} {
- line := line
t.Run(fmt.Sprintf("line-%d", line), func(t *testing.T) {
processAssertEmpty(t, p, newNolintFileIssue(line, "gosec"))
})
diff --git a/pkg/result/processors/severity_test.go b/pkg/result/processors/severity_test.go
index 5ae320b6626d..73b980f6c613 100644
--- a/pkg/result/processors/severity_test.go
+++ b/pkg/result/processors/severity_test.go
@@ -483,7 +483,6 @@ func TestSeverity_transform(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/result/processors/skip_dirs_test.go b/pkg/result/processors/skip_dirs_test.go
index 24450d983924..7a71754c6aa7 100644
--- a/pkg/result/processors/skip_dirs_test.go
+++ b/pkg/result/processors/skip_dirs_test.go
@@ -48,7 +48,6 @@ func Test_absDirs(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/pkg/result/processors/sort_results.go b/pkg/result/processors/sort_results.go
index 77f58c03e57c..4da73c72ea39 100644
--- a/pkg/result/processors/sort_results.go
+++ b/pkg/result/processors/sort_results.go
@@ -194,7 +194,7 @@ func mergeComparators(cmps []*comparator) (*comparator, error) {
return nil, errors.New("no comparator")
}
- for i := 0; i < len(cmps)-1; i++ {
+ for i := range len(cmps) - 1 {
findComparatorTip(cmps[i]).SetNext(cmps[i+1])
}
diff --git a/pkg/result/processors/sort_results_test.go b/pkg/result/processors/sort_results_test.go
index 46e8e76f1458..cc5b32ace543 100644
--- a/pkg/result/processors/sort_results_test.go
+++ b/pkg/result/processors/sort_results_test.go
@@ -79,8 +79,7 @@ type compareTestCase struct {
func testCompareValues(t *testing.T, cmp *comparator, name string, tests []compareTestCase) {
t.Parallel()
- for i := 0; i < len(tests); i++ {
- test := tests[i]
+ for i, test := range tests { //nolint:gocritic // To ignore rangeValCopy rule
t.Run(fmt.Sprintf("%s(%d)", name, i), func(t *testing.T) {
res := cmp.Compare(&test.a, &test.b)
assert.Equal(t, test.expected.String(), res.String())
@@ -200,8 +199,7 @@ func TestNumericCompare(t *testing.T) {
t.Parallel()
- for i := 0; i < len(tests); i++ {
- test := tests[i]
+ for i, test := range tests {
t.Run(fmt.Sprintf("%s(%d)", "Numeric Compare", i), func(t *testing.T) {
res := numericCompare(test.a, test.b)
assert.Equal(t, test.expected.String(), res.String())
@@ -267,7 +265,6 @@ func Test_mergeComparators(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/scripts/website/expand_templates/linters.go b/scripts/website/expand_templates/linters.go
index 465f35e4b101..1213dc45edc3 100644
--- a/scripts/website/expand_templates/linters.go
+++ b/scripts/website/expand_templates/linters.go
@@ -154,7 +154,7 @@ func formatDesc(desc string) string {
func hasSettings(name string) bool {
tp := reflect.TypeOf(config.LintersSettings{})
- for i := 0; i < tp.NumField(); i++ {
+ for i := range tp.NumField() {
if strings.EqualFold(name, tp.Field(i).Name) {
return true
}
diff --git a/test/enabled_linters_test.go b/test/enabled_linters_test.go
index 0de10a5a6037..2121641bd101 100644
--- a/test/enabled_linters_test.go
+++ b/test/enabled_linters_test.go
@@ -114,7 +114,6 @@ func TestEnabledLinters(t *testing.T) {
binPath := testshared.InstallGolangciLint(t)
for _, c := range cases {
- c := c
t.Run(c.name, func(t *testing.T) {
t.Parallel()
diff --git a/test/run_test.go b/test/run_test.go
index dd15f189054e..4c05402a3be5 100644
--- a/test/run_test.go
+++ b/test/run_test.go
@@ -144,7 +144,6 @@ func TestCgoWithIssues(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -242,7 +241,6 @@ func TestLineDirective(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -301,7 +299,6 @@ func TestLineDirectiveProcessedFiles(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -349,7 +346,6 @@ func TestSortedResults(t *testing.T) {
binPath := testshared.InstallGolangciLint(t)
for _, test := range testCases {
- test := test
t.Run(test.opt, func(t *testing.T) {
t.Parallel()
@@ -437,7 +433,6 @@ func TestConfigFileIsDetected(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -475,7 +470,6 @@ func TestEnableAllFastAndEnableCanCoexist(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
@@ -559,7 +553,6 @@ func TestPathPrefix(t *testing.T) {
binPath := testshared.InstallGolangciLint(t)
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
testshared.NewRunnerBuilder(t).
WithArgs(test.args...).
diff --git a/test/testshared/analysis_test.go b/test/testshared/analysis_test.go
index 7446b041c2f7..52541ff3274b 100644
--- a/test/testshared/analysis_test.go
+++ b/test/testshared/analysis_test.go
@@ -124,7 +124,6 @@ func println(...interface{}) { println() } // want println:"found" "call of prin
}
for _, test := range testCases {
- test := test
t.Run(test.filename, func(t *testing.T) {
t.Parallel()
diff --git a/test/testshared/directives_test.go b/test/testshared/directives_test.go
index 2f8ec6c3291e..9b52ac97ac0a 100644
--- a/test/testshared/directives_test.go
+++ b/test/testshared/directives_test.go
@@ -72,7 +72,6 @@ func Test_evaluateBuildTags(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
diff --git a/test/testshared/integration/fix.go b/test/testshared/integration/fix.go
index 29d95960b2d6..ddd5c5e5ab95 100644
--- a/test/testshared/integration/fix.go
+++ b/test/testshared/integration/fix.go
@@ -56,8 +56,6 @@ func runFix(t *testing.T, extraArgs ...string) {
sources := setupTestFix(t)
for _, input := range sources {
- input := input
-
t.Run(filepath.Base(input), func(t *testing.T) {
t.Parallel()
diff --git a/test/testshared/integration/run.go b/test/testshared/integration/run.go
index 737bb78e5420..9b0dac15c837 100644
--- a/test/testshared/integration/run.go
+++ b/test/testshared/integration/run.go
@@ -42,7 +42,6 @@ func RunTestSourcesFromDir(t *testing.T, dir string) {
log.SetLevel(logutils.LogLevelInfo)
for _, source := range sources {
- source := source
t.Run(filepath.Base(source), func(subTest *testing.T) {
subTest.Parallel()
diff --git a/test/testshared/runner_test.go b/test/testshared/runner_test.go
index 5d2b3634387d..5dcb10f26e24 100644
--- a/test/testshared/runner_test.go
+++ b/test/testshared/runner_test.go
@@ -167,7 +167,6 @@ func TestRunnerBuilder_Runner(t *testing.T) {
}
for _, test := range testCases {
- test := test
t.Run(test.desc, func(t *testing.T) {
t.Parallel()