Skip to content

Commit 551e581

Browse files
authored
Merge branch 'master' into add-new-linter-ttempdir
2 parents 6a8f7c3 + a2cc1c4 commit 551e581

16 files changed

+194
-34
lines changed

.golangci.next.reference.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2192,13 +2192,16 @@ linters-settings:
21922192
- error-nil
21932193
- expected-actual
21942194
- float-compare
2195+
- formatter
21952196
- go-require
21962197
- len
21972198
- negative-positive
21982199
- nil-compare
21992200
- require-error
2201+
- suite-broken-parallel
22002202
- suite-dont-use-pkg
22012203
- suite-extra-assert-call
2204+
- suite-subtest-run
22022205
- suite-thelper
22032206
- useless-assert
22042207

@@ -2208,7 +2211,8 @@ linters-settings:
22082211
# Enable checkers by name
22092212
# (in addition to default
22102213
# blank-import, bool-compare, compares, empty, error-is-as, error-nil, expected-actual, go-require, float-compare,
2211-
# len, negative-positive, nil-compare, require-error, suite-dont-use-pkg, suite-extra-assert-call, useless-assert
2214+
# formatter, len, negative-positive, nil-compare, require-error, suite-broken-parallel, suite-dont-use-pkg,
2215+
# suite-extra-assert-call, suite-subtest-run, useless-assert
22122216
# ).
22132217
enable:
22142218
- blank-import
@@ -2219,13 +2223,16 @@ linters-settings:
22192223
- error-nil
22202224
- expected-actual
22212225
- float-compare
2226+
- formatter
22222227
- go-require
22232228
- len
22242229
- negative-positive
22252230
- nil-compare
22262231
- require-error
2232+
- suite-broken-parallel
22272233
- suite-dont-use-pkg
22282234
- suite-extra-assert-call
2235+
- suite-subtest-run
22292236
- suite-thelper
22302237
- useless-assert
22312238

@@ -2237,6 +2244,13 @@ linters-settings:
22372244
# Regexp for expected variable name.
22382245
# Default: (^(exp(ected)?|want(ed)?)([A-Z]\w*)?$)|(^(\w*[a-z])?(Exp(ected)?|Want(ed)?)$)
22392246
pattern: ^expected
2247+
formatter:
2248+
# To enable go vet's printf checks.
2249+
# Default: true
2250+
check-format-string: false
2251+
# To require f-assertions if format string is used.
2252+
# Default: false
2253+
require-f-funcs: true
22402254
go-require:
22412255
# To ignore HTTP handlers (like http.HandlerFunc).
22422256
# Default: false

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint) and on [Twitter](https://twitter.com/golangci).
22

3+
### v1.59.1
4+
5+
1. Updated linters
6+
* `go-errorlint`: from 1.5.1 to 1.5.2
7+
* `gomnd`: deprecated configuration compatibility
8+
* `intrange`: add `style` preset
9+
* `misspell`: from 0.5.1 to 0.6.0
10+
* `sloglint`: from 0.7.0 to 0.7.1
11+
* `testifylint`: from 1.3.0 to 1.3.1
12+
* `unparam`: bump to HEAD
13+
* `usestdlibvars`: from 1.25.0 to 1.26.0
14+
2. Fixes
15+
* SARIF: init empty result slice
16+
* SARIF: issue column >= 1
17+
3. Documentation
18+
* update `revive` configuration
19+
320
### v1.59.0
421

522
1. Enhancements

assets/github-action-config.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"MinorVersionToConfig": {
33
"latest": {
4-
"TargetVersion": "v1.59.0",
5-
"AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.59.0/golangci-lint-1.59.0-linux-amd64.tar.gz"
4+
"TargetVersion": "v1.59.1",
5+
"AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.59.1/golangci-lint-1.59.1-linux-amd64.tar.gz"
66
},
77
"v1.10": {
88
"Error": "golangci-lint version 'v1.10' isn't supported: we support only v1.14.0 and later versions"
@@ -206,8 +206,8 @@
206206
"AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.58.2/golangci-lint-1.58.2-linux-amd64.tar.gz"
207207
},
208208
"v1.59": {
209-
"TargetVersion": "v1.59.0",
210-
"AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.59.0/golangci-lint-1.59.0-linux-amd64.tar.gz"
209+
"TargetVersion": "v1.59.1",
210+
"AssetURL": "https://github.com/golangci/golangci-lint/releases/download/v1.59.1/golangci-lint-1.59.1-linux-amd64.tar.gz"
211211
},
212212
"v1.6": {
213213
"Error": "golangci-lint version 'v1.6' isn't supported: we support only v1.14.0 and later versions"

assets/linters-info.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,9 @@
749749
"name": "intrange",
750750
"desc": "intrange is a linter to find places where for loops could make use of an integer range.",
751751
"loadMode": 7,
752+
"inPresets": [
753+
"style"
754+
],
752755
"originalURL": "https://github.com/ckaznocha/intrange",
753756
"internal": false,
754757
"isSlow": false,

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ require (
99
github.com/Abirdcfly/dupword v0.0.14
1010
github.com/Antonboom/errname v0.1.13
1111
github.com/Antonboom/nilnil v0.1.9
12-
github.com/Antonboom/testifylint v1.3.1
12+
github.com/Antonboom/testifylint v1.4.1
1313
github.com/BurntSushi/toml v1.4.0
14-
github.com/Crocmagnon/fatcontext v0.2.2
14+
github.com/Crocmagnon/fatcontext v0.3.0
1515
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
16-
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0
16+
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0
1717
github.com/OpenPeeDeeP/depguard/v2 v2.2.0
1818
github.com/alecthomas/go-check-sumtype v0.1.4
1919
github.com/alexkohler/nakedret/v2 v2.0.4
@@ -23,7 +23,7 @@ require (
2323
github.com/ashanbrown/makezero v1.1.1
2424
github.com/bkielbasa/cyclop v1.2.1
2525
github.com/blizzy78/varnamelen v0.8.0
26-
github.com/bombsimon/wsl/v4 v4.2.1
26+
github.com/bombsimon/wsl/v4 v4.4.0
2727
github.com/breml/bidichk v0.2.7
2828
github.com/breml/errchkjson v0.3.6
2929
github.com/butuzov/ireturn v0.3.0
@@ -44,7 +44,7 @@ require (
4444
github.com/gofrs/flock v0.8.1
4545
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
4646
github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e
47-
github.com/golangci/misspell v0.5.1
47+
github.com/golangci/misspell v0.6.0
4848
github.com/golangci/modinfo v0.3.4
4949
github.com/golangci/plugin-module-register v0.1.1
5050
github.com/golangci/revgrep v0.5.3
@@ -92,7 +92,7 @@ require (
9292
github.com/sanposhiho/wastedassign/v2 v2.0.7
9393
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
9494
github.com/sashamelentyev/interfacebloat v1.1.0
95-
github.com/sashamelentyev/usestdlibvars v1.25.0
95+
github.com/sashamelentyev/usestdlibvars v1.26.0
9696
github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9
9797
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
9898
github.com/shirou/gopsutil/v3 v3.24.5

go.sum

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2887,13 +2887,16 @@
28872887
"error-nil",
28882888
"expected-actual",
28892889
"float-compare",
2890+
"formatter",
28902891
"go-require",
28912892
"len",
28922893
"negative-positive",
28932894
"nil-compare",
28942895
"require-error",
2896+
"suite-broken-parallel",
28952897
"suite-dont-use-pkg",
28962898
"suite-extra-assert-call",
2899+
"suite-subtest-run",
28972900
"suite-thelper",
28982901
"useless-assert"
28992902
]
@@ -2907,13 +2910,16 @@
29072910
"error-nil",
29082911
"expected-actual",
29092912
"float-compare",
2913+
"float-compare",
29102914
"go-require",
29112915
"len",
29122916
"negative-positive",
29132917
"nil-compare",
29142918
"require-error",
2919+
"suite-broken-parallel",
29152920
"suite-dont-use-pkg",
29162921
"suite-extra-assert-call",
2922+
"suite-subtest-run",
29172923
"useless-assert"
29182924
]
29192925
},
@@ -2930,13 +2936,16 @@
29302936
"error-nil",
29312937
"expected-actual",
29322938
"float-compare",
2939+
"formatter",
29332940
"go-require",
29342941
"len",
29352942
"negative-positive",
29362943
"nil-compare",
29372944
"require-error",
2945+
"suite-broken-parallel",
29382946
"suite-dont-use-pkg",
29392947
"suite-extra-assert-call",
2948+
"suite-subtest-run",
29402949
"suite-thelper",
29412950
"useless-assert"
29422951
],
@@ -2967,6 +2976,22 @@
29672976
}
29682977
}
29692978
},
2979+
"formatter": {
2980+
"type": "object",
2981+
"additionalProperties": false,
2982+
"properties": {
2983+
"check-format-string": {
2984+
"description": "To enable go vet's printf checks.",
2985+
"type": "boolean",
2986+
"default": true
2987+
},
2988+
"require-f-funcs": {
2989+
"description": "To require f-assertions if format string is used.",
2990+
"type": "boolean",
2991+
"default": false
2992+
}
2993+
}
2994+
},
29702995
"go-require": {
29712996
"type": "object",
29722997
"additionalProperties": false,

pkg/config/linters_settings.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,11 @@ type TestifylintSettings struct {
880880
ExpVarPattern string `mapstructure:"pattern"`
881881
} `mapstructure:"expected-actual"`
882882

883+
Formatter struct {
884+
CheckFormatString *bool `mapstructure:"check-format-string"`
885+
RequireFFuncs bool `mapstructure:"require-f-funcs"`
886+
} `mapstructure:"formatter"`
887+
883888
GoRequire struct {
884889
IgnoreHTTPHandlers bool `mapstructure:"ignore-http-handlers"`
885890
} `mapstructure:"go-require"`

pkg/golinters/fatcontext/testdata/fatcontext.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,44 @@ func example() {
3131
func wrapContext(ctx context.Context) context.Context {
3232
return context.WithoutCancel(ctx)
3333
}
34+
35+
// storing contexts in a struct isn't recommended, but local copies of a non-pointer struct should act like local copies of a context.
36+
func inStructs(ctx context.Context) {
37+
for i := 0; i < 10; i++ {
38+
c := struct{ Ctx context.Context }{ctx}
39+
c.Ctx = context.WithValue(c.Ctx, "key", i)
40+
c.Ctx = context.WithValue(c.Ctx, "other", "val")
41+
}
42+
43+
for i := 0; i < 10; i++ {
44+
c := []struct{ Ctx context.Context }{{ctx}}
45+
c[0].Ctx = context.WithValue(c[0].Ctx, "key", i)
46+
c[0].Ctx = context.WithValue(c[0].Ctx, "other", "val")
47+
}
48+
49+
c := struct{ Ctx context.Context }{ctx}
50+
for i := 0; i < 10; i++ {
51+
c := c
52+
c.Ctx = context.WithValue(c.Ctx, "key", i)
53+
c.Ctx = context.WithValue(c.Ctx, "other", "val")
54+
}
55+
56+
pc := &struct{ Ctx context.Context }{ctx}
57+
for i := 0; i < 10; i++ {
58+
c := pc
59+
c.Ctx = context.WithValue(c.Ctx, "key", i) // want "nested context in loop"
60+
c.Ctx = context.WithValue(c.Ctx, "other", "val")
61+
}
62+
63+
r := []struct{ Ctx context.Context }{{ctx}}
64+
for i := 0; i < 10; i++ {
65+
r[0].Ctx = context.WithValue(r[0].Ctx, "key", i) // want "nested context in loop"
66+
r[0].Ctx = context.WithValue(r[0].Ctx, "other", "val")
67+
}
68+
69+
rp := []*struct{ Ctx context.Context }{{ctx}}
70+
for i := 0; i < 10; i++ {
71+
rp[0].Ctx = context.WithValue(rp[0].Ctx, "key", i) // want "nested context in loop"
72+
rp[0].Ctx = context.WithValue(rp[0].Ctx, "other", "val")
73+
}
74+
}

pkg/golinters/lll/lll.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r
121121
Filename: filename,
122122
Line: lineNumber,
123123
},
124-
Text: fmt.Sprintf("line is %d characters", lineLen),
124+
Text: fmt.Sprintf("the line is %d characters long, which exceeds the maximum of %d characters.", lineLen, maxLineLen),
125125
FromLinter: linterName,
126126
})
127127
}

0 commit comments

Comments
 (0)