Skip to content

Commit 51efe46

Browse files
authored
Merge branch 'main' into gofuncor
2 parents 7e61de8 + 638ece2 commit 51efe46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1023
-805
lines changed

.golangci.next.reference.yml

Lines changed: 57 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ linters:
337337
# List of file globs that will match this list of settings to compare against.
338338
# By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
339339
# The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
340+
# The placeholder '${config-path}' is substituted with a path relative to the configuration file.
340341
# Default: $all
341342
files:
342343
- "!**/*_a _file.go"
@@ -1171,6 +1172,7 @@ linters:
11711172
# Comma-separated list of file paths containing ruleguard rules.
11721173
# By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
11731174
# The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
1175+
# The placeholder '${config-path}' is substituted with a path relative to the configuration file.
11741176
# Glob patterns such as 'rules-*.go' may be specified.
11751177
# Default: ""
11761178
rules: '${base-path}/ruleguard/rules-*.go,${base-path}/myrule1.go'
@@ -1266,6 +1268,7 @@ linters:
12661268
# Useful if you need to load the template from a specific file.
12671269
# By default, if a path is relative, it is relative to the directory where the golangci-lint command is executed.
12681270
# The placeholder '${base-path}' is substituted with a path relative to the mode defined with `run.relative-path-mode`.
1271+
# The placeholder '${config-path}' is substituted with a path relative to the configuration file.
12691272
# Default: ""
12701273
template-path: /path/to/my/template.tmpl
12711274

@@ -1349,7 +1352,6 @@ linters:
13491352
- G110 # Potential DoS vulnerability via decompression bomb
13501353
- G111 # Potential directory traversal
13511354
- G112 # Potential slowloris attack
1352-
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
13531355
- G114 # Use of net/http serve function that has no support for setting timeouts
13541356
- G115 # Potential integer overflow when converting between integer types
13551357
- G201 # SQL query construction using format string
@@ -1394,7 +1396,6 @@ linters:
13941396
- G110 # Potential DoS vulnerability via decompression bomb
13951397
- G111 # Potential directory traversal
13961398
- G112 # Potential slowloris attack
1397-
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
13981399
- G114 # Use of net/http serve function that has no support for setting timeouts
13991400
- G115 # Potential integer overflow when converting between integer types
14001401
- G201 # SQL query construction using format string
@@ -2179,10 +2180,10 @@ linters:
21792180
disabled: false
21802181
exclude: [""]
21812182
arguments:
2182-
- maxLitCount: "3"
2183-
allowStrs: '""'
2184-
allowInts: "0,1,2"
2185-
allowFloats: "0.0,0.,1.0,1.,2.0,2."
2183+
- max-lit-count: "3"
2184+
allow-strs: '""'
2185+
allow-ints: "0,1,2"
2186+
allow-floats: "0.0,0.,1.0,1.,2.0,2."
21862187
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#argument-limit
21872188
- name: argument-limit
21882189
severity: warning
@@ -2261,7 +2262,7 @@ linters:
22612262
disabled: false
22622263
exclude: [""]
22632264
arguments:
2264-
- allowTypesBefore: "*testing.T,*github.com/user/repo/testing.Harness"
2265+
- allow-types-before: "*testing.T,*github.com/user/repo/testing.Harness"
22652266
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#context-keys-type
22662267
- name: context-keys-type
22672268
severity: warning
@@ -2301,7 +2302,7 @@ linters:
23012302
disabled: false
23022303
exclude: [""]
23032304
arguments:
2304-
- allowedPackages: ["github.com/onsi/ginkgo/v2", "github.com/onsi/gomega"]
2305+
- allowed-packages: ["github.com/onsi/ginkgo/v2", "github.com/onsi/gomega"]
23052306
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#duplicated-imports
23062307
- name: duplicated-imports
23072308
severity: warning
@@ -2313,8 +2314,8 @@ linters:
23132314
disabled: false
23142315
exclude: [""]
23152316
arguments:
2316-
- "preserveScope"
2317-
- "allowJump"
2317+
- "preserve-scope"
2318+
- "allow-jump"
23182319
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#empty-block
23192320
- name: empty-block
23202321
severity: warning
@@ -2340,8 +2341,8 @@ linters:
23402341
arguments:
23412342
- "short"
23422343
# Or this parameter:
2343-
- funcArgStyle: "full"
2344-
funcRetValStyle: "short"
2344+
- func-arg-style: "full"
2345+
func-ret-val-style: "short"
23452346
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#enforce-slice-style
23462347
- name: enforce-slice-style
23472348
severity: warning
@@ -2377,15 +2378,15 @@ linters:
23772378
disabled: false
23782379
exclude: [""]
23792380
arguments:
2380-
- "checkPrivateReceivers"
2381-
- "disableStutteringCheck"
2382-
- "sayRepetitiveInsteadOfStutters"
2383-
- "checkPublicInterface"
2384-
- "disableChecksOnConstants"
2385-
- "disableChecksOnFunctions"
2386-
- "disableChecksOnMethods"
2387-
- "disableChecksOnTypes"
2388-
- "disableChecksOnVariables"
2381+
- "check-private-receivers"
2382+
- "disable-stuttering-check"
2383+
- "say-repetitive-instead-of-stutters"
2384+
- "check-public-interface"
2385+
- "disable-checks-on-constants"
2386+
- "disable-checks-on-functions"
2387+
- "disable-checks-on-methods"
2388+
- "disable-checks-on-types"
2389+
- "disable-checks-on-variables"
23892390
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#file-header
23902391
- name: file-header
23912392
severity: warning
@@ -2400,8 +2401,8 @@ linters:
24002401
exclude: [""]
24012402
arguments:
24022403
- max: 100
2403-
skipComments: true
2404-
skipBlankLines: true
2404+
skip-comments: true
2405+
skip-blank-lines: true
24052406
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#filename-format
24062407
- name: filename-format
24072408
severity: warning
@@ -2449,8 +2450,8 @@ linters:
24492450
arguments:
24502451
- "^[a-z][a-z0-9]{0,}$"
24512452
# Or this parameter:
2452-
- allowRegex: "^[a-z][a-z0-9]{0,}$"
2453-
denyRegex: '^v\d+$'
2453+
- allow-regex: "^[a-z][a-z0-9]{0,}$"
2454+
deny-regex: '^v\d+$'
24542455
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#import-shadowing
24552456
- name: import-shadowing
24562457
severity: warning
@@ -2475,7 +2476,7 @@ linters:
24752476
disabled: false
24762477
exclude: [""]
24772478
arguments:
2478-
- "preserveScope"
2479+
- "preserve-scope"
24792480
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#line-length-limit
24802481
- name: line-length-limit
24812482
severity: warning
@@ -2540,7 +2541,7 @@ linters:
25402541
disabled: false
25412542
exclude: [""]
25422543
arguments:
2543-
- maxLength: 2
2544+
- max-length: 2
25442545
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#redefines-builtin-id
25452546
- name: redefines-builtin-id
25462547
severity: warning
@@ -2556,6 +2557,11 @@ linters:
25562557
severity: warning
25572558
disabled: false
25582559
exclude: [""]
2560+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redundant-test-main-exit
2561+
- name: redundant-test-main-exit
2562+
severity: warning
2563+
disabled: false
2564+
exclude: [""]
25592565
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#string-format
25602566
- name: string-format
25612567
severity: warning
@@ -2590,7 +2596,7 @@ linters:
25902596
disabled: false
25912597
exclude: [""]
25922598
arguments:
2593-
- "preserveScope"
2599+
- "preserve-scope"
25942600
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#time-equal
25952601
- name: time-equal
25962602
severity: warning
@@ -2607,7 +2613,7 @@ linters:
26072613
disabled: false
26082614
exclude: [""]
26092615
arguments:
2610-
- acceptIgnoredAssertionResult: true
2616+
- accept-ignored-assertion-result: true
26112617
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unconditional-recursion
26122618
- name: unconditional-recursion
26132619
severity: warning
@@ -2647,14 +2653,14 @@ linters:
26472653
disabled: false
26482654
exclude: [""]
26492655
arguments:
2650-
- allowRegex: "^_"
2656+
- allow-regex: "^_"
26512657
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-receiver
26522658
- name: unused-receiver
26532659
severity: warning
26542660
disabled: false
26552661
exclude: [""]
26562662
arguments:
2657-
- allowRegex: "^_"
2663+
- allow-regex: "^_"
26582664
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#use-any
26592665
- name: use-any
26602666
severity: warning
@@ -2683,7 +2689,7 @@ linters:
26832689
arguments:
26842690
- [ "ID" ] # AllowList
26852691
- [ "VM" ] # DenyList
2686-
- - upperCaseConst: true # Extra parameter (upperCaseConst|skipPackageNameChecks)
2692+
- - upper-case-const: true # Extra parameter (upper-case-const|skip-package-name-checks)
26872693
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#waitgroup-by-value
26882694
- name: waitgroup-by-value
26892695
severity: warning
@@ -2729,11 +2735,16 @@ linters:
27292735
# https://github.com/go-simpler/sloglint?tab=readme-ov-file#static-messages
27302736
# Default: false
27312737
static-msg: true
2738+
# Enforce message style.
2739+
# Values: lowercased, capitalized
2740+
# https://github.com/go-simpler/sloglint?tab=readme-ov-file#message-style
2741+
# Default: ""
2742+
msg-style: capitalized
27322743
# Enforce using constants instead of raw keys.
27332744
# https://github.com/go-simpler/sloglint?tab=readme-ov-file#no-raw-keys
27342745
# Default: false
27352746
no-raw-keys: true
2736-
# Enforce a single key naming convention.
2747+
# Enforce key naming convention.
27372748
# Values: snake, kebab, camel, pascal
27382749
# https://github.com/go-simpler/sloglint?tab=readme-ov-file#key-naming-convention
27392750
# Default: ""
@@ -3405,12 +3416,6 @@ linters:
34053416
# Default: false
34063417
ignore: true
34073418

3408-
tenv:
3409-
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
3410-
# Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
3411-
# Default: false
3412-
all: false
3413-
34143419
testifylint:
34153420
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
34163421
# Default: false
@@ -3768,6 +3773,9 @@ linters:
37683773
# Default: []
37693774
ignore-interface-regexps:
37703775
- ^(?i)c(?-i)ach(ing|e)
3776+
# Determines whether wrapcheck should report errors returned from inside the package.
3777+
# Default: false
3778+
report-internal-errors: true
37713779

37723780
wsl:
37733781
# Do strict checking when assigning from append (x = append(x, y)).
@@ -4032,6 +4040,9 @@ formatters:
40324040
chain-split-dots: false
40334041

40344042
exclusions:
4043+
# Log a warning if an exclusion path is unused.
4044+
# Default: false
4045+
warn-unused: true
40354046
# Mode of the generated files analysis.
40364047
#
40374048
# - `strict`: sources are excluded by strictly following the Go generated file convention.
@@ -4165,9 +4176,16 @@ output:
41654176
path: ./path/to/output.json
41664177

41674178
# Add a prefix to the output file references.
4179+
# This option is ignored when using `output.path-mode: abs` mode.
41684180
# Default: ""
41694181
path-prefix: ""
41704182

4183+
# By default, the report are related to the path obtained by `run.relative-path-mode`.
4184+
# The mode `abs` allows to show absolute file paths instead of relative file paths.
4185+
# The option `output.path-prefix` is ignored when using `abs` mode.
4186+
# Default: ""
4187+
path-mode: "abs"
4188+
41714189
# Order to use when sorting results.
41724190
# Possible values: `file`, `linter`, and `severity`.
41734191
#

.golangci.reference.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,6 +2546,11 @@ linters:
25462546
severity: warning
25472547
disabled: false
25482548
exclude: [""]
2549+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redundant-test-main-exit
2550+
- name: redundant-test-main-exit
2551+
severity: warning
2552+
disabled: false
2553+
exclude: [""]
25492554
# https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#string-format
25502555
- name: string-format
25512556
severity: warning
@@ -3395,12 +3400,6 @@ linters:
33953400
# Default: false
33963401
ignore: true
33973402

3398-
tenv:
3399-
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
3400-
# Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
3401-
# Default: false
3402-
all: false
3403-
34043403
testifylint:
34053404
# Enable all checkers (https://github.com/Antonboom/testifylint#checkers).
34063405
# Default: false

docs/src/@rocketseat/gatsby-theme-docs/src/styles/global.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default function GlobalStyle() {
6666
font-weight: 400;
6767
}
6868
69+
span.inline-code,
6970
code.inline-code {
7071
display: inline-block;
7172
vertical-align: middle;

docs/src/docs/product/migration-guide.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ The `migrate` command enforces the following default values:
4343

4444
Other fields explicitly defined in the configuration file are migrated even if the value is the same as the default value.
4545

46+
The `migrate` command automatically migrates `linters.presets` in individual linters to `linters.enable`.
47+
4648
```txt
4749
Migrate configuration file from v1 to v2
4850
@@ -189,7 +191,9 @@ There are 2 new options (they are not strictly equivalent to the previous option
189191

190192
#### `linters.presets`
191193

192-
This property have been removed.
194+
This property has been removed.
195+
196+
The `migrate` command automatically migrates `linters.presets` in individual linters to `linters.enable`.
193197

194198
<details>
195199
<summary style={{color: '#737380', paddingLeft: '1rem'}}>v1</summary>

docs/src/docs/welcome/install.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ go tool -modfile=golangci-lint.mod golangci-lint run
203203

204204
```sh
205205
# Update golangci-lint
206-
go get -tool -modfile=golangci-lint.mod github.com/golangci/v2/golangci-lint/cmd/golangci-lint@latest
206+
go get -tool -modfile=golangci-lint.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
207207
```
208208

209209
**Method 2: dedicated module**

docs/src/docs/welcome/integrations.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ title: Integrations
66

77
### GoLand
88

9+
The integration for golangci-lint v2 is currently in work in progress: [GO-18363](https://youtrack.jetbrains.com/issue/GO-18363/Go-Linter-plugin-fails-with-golangci-lint-v2).
10+
911
Install [plugin](https://plugins.jetbrains.com/plugin/12496-go-linter).
1012

1113
### Visual Studio Code
1214

15+
The integration for golangci-lint v2 is currently in work in progress: [vscode-go#3732](https://github.com/golang/vscode-go/issues/3732).
16+
1317
Install the [extension](https://marketplace.visualstudio.com/items?itemName=golang.Go).
1418

1519
<details>

docs/static/demo.gif

133 KB
Loading

0 commit comments

Comments
 (0)