Skip to content

build(deps): bump github.com/karamaru-alpha/copyloopvar from 1.0.10 to 1.1.0 #4632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ linters-settings:
pop-directional-isolate: false

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

cyclop:
# The maximal code complexity to report.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ require (
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af
github.com/jjti/go-spancheck v0.5.3
github.com/julz/importas v0.1.0
github.com/karamaru-alpha/copyloopvar v1.0.10
github.com/karamaru-alpha/copyloopvar v1.1.0
github.com/kisielk/errcheck v1.7.0
github.com/kkHAIKE/contextcheck v1.1.5
github.com/kulti/thelper v0.6.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3172,7 +3172,7 @@
"type": "object",
"additionalProperties": false,
"properties": {
"ignore-alias": {
"check-alias": {
"type": "boolean",
"default": false
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ type BiDiChkSettings struct {
}

type CopyLoopVarSettings struct {
IgnoreAlias bool `mapstructure:"ignore-alias"`
IgnoreAlias bool `mapstructure:"ignore-alias"` // Deprecated: use CheckAlias
CheckAlias bool `mapstructure:"check-alias"`
}

type Cyclop struct {
Expand Down
5 changes: 5 additions & 0 deletions pkg/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ func (l *Loader) handleLinterOptionDeprecations() {
"Please enable `shadow` instead, if you are not using `enable-all`.")
}

if l.cfg.LintersSettings.CopyLoopVar.IgnoreAlias {
l.log.Warnf("The configuration option `linters.copyloopvar.ignore-alias` is deprecated and ignored," +
"please use `linters.copyloopvar.check-alias`.")
}

// Deprecated since v1.42.0.
if l.cfg.LintersSettings.Errcheck.Exclude != "" {
l.log.Warnf("The configuration option `linters.errcheck.exclude` is deprecated, please use `linters.errcheck.exclude-functions`.")
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/copyloopvar/copyloopvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func New(settings *config.CopyLoopVarSettings) *goanalysis.Linter {
if settings != nil {
cfg = map[string]map[string]any{
a.Name: {
"ignore-alias": settings.IgnoreAlias,
"check-alias": settings.CheckAlias,
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/copyloopvar/testdata/copyloopvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func copyloopvarCase1() {
fns = append(fns, func() {
fmt.Println(v)
})
_v := v // want `The copy of the 'for' variable "v" can be deleted \(Go 1\.22\+\)`
_v := v
_ = _v
}
for _, fn := range fns {
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/copyloopvar/testdata/copyloopvar.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
linters-settings:
copyloopvar:
ignore-alias: true
check-alias: true
2 changes: 1 addition & 1 deletion pkg/golinters/copyloopvar/testdata/copyloopvar_custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func copyloopvarCase1() {
fns = append(fns, func() {
fmt.Println(v)
})
_v := v
_v := v // want `The copy of the 'for' variable "v" can be deleted \(Go 1\.22\+\)`
_ = _v
}
for _, fn := range fns {
Expand Down