-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(deps): bump github.com/karamaru-alpha/copyloopvar from 1.0.4 to…
… 1.0.8 (#4444)
- Loading branch information
1 parent
b5c339f
commit df70758
Showing
9 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
linters-settings: | ||
copyloopvar: | ||
ignore-alias: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//go:build go1.22 | ||
|
||
//golangcitest:args -Ecopyloopvar | ||
//golangcitest:config_path testdata/configs/copyloopvar.yml | ||
package testdata | ||
|
||
import "fmt" | ||
|
||
func copyloopvarCase1() { | ||
slice := []int{1, 2, 3} | ||
fns := make([]func(), 0, len(slice)*2) | ||
for i, v := range slice { | ||
i := i // want `The copy of the 'for' variable "i" can be deleted \(Go 1\.22\+\)` | ||
fns = append(fns, func() { | ||
fmt.Println(i) | ||
}) | ||
v := v // want `The copy of the 'for' variable "v" can be deleted \(Go 1\.22\+\)` | ||
fns = append(fns, func() { | ||
fmt.Println(v) | ||
}) | ||
_v := v | ||
_ = _v | ||
} | ||
for _, fn := range fns { | ||
fn() | ||
} | ||
} | ||
|
||
func copyloopvarCase2() { | ||
loopCount := 3 | ||
fns := make([]func(), 0, loopCount) | ||
for i := 1; i <= loopCount; i++ { | ||
i := i // want `The copy of the 'for' variable "i" can be deleted \(Go 1\.22\+\)` | ||
fns = append(fns, func() { | ||
fmt.Println(i) | ||
}) | ||
} | ||
for _, fn := range fns { | ||
fn() | ||
} | ||
} |