Skip to content

Commit

Permalink
build(deps): bump github.com/karamaru-alpha/copyloopvar from 1.0.10 t…
Browse files Browse the repository at this point in the history
…o 1.1.0 (#4632)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
  • Loading branch information
dependabot[bot] and ldez committed Apr 10, 2024
1 parent 2c666ed commit 3f63db1
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 11 deletions.
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

0 comments on commit 3f63db1

Please sign in to comment.