Skip to content

Commit 3f63db1

Browse files
build(deps): bump github.com/karamaru-alpha/copyloopvar from 1.0.10 to 1.1.0 (#4632)
Co-authored-by: Fernandez Ludovic <[email protected]>
1 parent 2c666ed commit 3f63db1

10 files changed

+17
-11
lines changed

.golangci.next.reference.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ linters-settings:
154154
pop-directional-isolate: false
155155

156156
copyloopvar:
157-
# If true, ignore aliasing of loop variables.
157+
# Check all assigning the loop variable to another variable.
158158
# Default: false
159-
ignore-alias: true
159+
check-alias: true
160160

161161
cyclop:
162162
# The maximal code complexity to report.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ require (
5959
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af
6060
github.com/jjti/go-spancheck v0.5.3
6161
github.com/julz/importas v0.1.0
62-
github.com/karamaru-alpha/copyloopvar v1.0.10
62+
github.com/karamaru-alpha/copyloopvar v1.1.0
6363
github.com/kisielk/errcheck v1.7.0
6464
github.com/kkHAIKE/contextcheck v1.1.5
6565
github.com/kulti/thelper v0.6.3

go.sum

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3172,7 +3172,7 @@
31723172
"type": "object",
31733173
"additionalProperties": false,
31743174
"properties": {
3175-
"ignore-alias": {
3175+
"check-alias": {
31763176
"type": "boolean",
31773177
"default": false
31783178
}

pkg/config/linters_settings.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ type BiDiChkSettings struct {
315315
}
316316

317317
type CopyLoopVarSettings struct {
318-
IgnoreAlias bool `mapstructure:"ignore-alias"`
318+
IgnoreAlias bool `mapstructure:"ignore-alias"` // Deprecated: use CheckAlias
319+
CheckAlias bool `mapstructure:"check-alias"`
319320
}
320321

321322
type Cyclop struct {

pkg/config/loader.go

+5
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,11 @@ func (l *Loader) handleLinterOptionDeprecations() {
363363
"Please enable `shadow` instead, if you are not using `enable-all`.")
364364
}
365365

366+
if l.cfg.LintersSettings.CopyLoopVar.IgnoreAlias {
367+
l.log.Warnf("The configuration option `linters.copyloopvar.ignore-alias` is deprecated and ignored," +
368+
"please use `linters.copyloopvar.check-alias`.")
369+
}
370+
366371
// Deprecated since v1.42.0.
367372
if l.cfg.LintersSettings.Errcheck.Exclude != "" {
368373
l.log.Warnf("The configuration option `linters.errcheck.exclude` is deprecated, please use `linters.errcheck.exclude-functions`.")

pkg/golinters/copyloopvar/copyloopvar.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func New(settings *config.CopyLoopVarSettings) *goanalysis.Linter {
1515
if settings != nil {
1616
cfg = map[string]map[string]any{
1717
a.Name: {
18-
"ignore-alias": settings.IgnoreAlias,
18+
"check-alias": settings.CheckAlias,
1919
},
2020
}
2121
}

pkg/golinters/copyloopvar/testdata/copyloopvar.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func copyloopvarCase1() {
1717
fns = append(fns, func() {
1818
fmt.Println(v)
1919
})
20-
_v := v // want `The copy of the 'for' variable "v" can be deleted \(Go 1\.22\+\)`
20+
_v := v
2121
_ = _v
2222
}
2323
for _, fn := range fns {
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
linters-settings:
22
copyloopvar:
3-
ignore-alias: true
3+
check-alias: true

pkg/golinters/copyloopvar/testdata/copyloopvar_custom.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func copyloopvarCase1() {
1818
fns = append(fns, func() {
1919
fmt.Println(v)
2020
})
21-
_v := v
21+
_v := v // want `The copy of the 'for' variable "v" can be deleted \(Go 1\.22\+\)`
2222
_ = _v
2323
}
2424
for _, fn := range fns {

0 commit comments

Comments
 (0)