-
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggest strings.ContainsFunc instead of strings.IndexFunc with Go 1.21+
- Loading branch information
Showing
5 changed files
with
47 additions
and
2 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
11 changes: 11 additions & 0 deletions
11
simple/testdata/src/example.com/CheckStringsContains_go120/contains.go
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,11 @@ | ||
package pkg | ||
|
||
import ( | ||
"bytes" | ||
"strings" | ||
) | ||
|
||
func fn() { | ||
_ = bytes.IndexFunc(nil, func(r rune) bool { return false }) != -1 | ||
_ = strings.IndexFunc("", func(r rune) bool { return false }) != -1 | ||
} |
11 changes: 11 additions & 0 deletions
11
simple/testdata/src/example.com/CheckStringsContains_go121/contains.go
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,11 @@ | ||
package pkg | ||
|
||
import ( | ||
"bytes" | ||
"strings" | ||
) | ||
|
||
func fn() { | ||
_ = bytes.IndexFunc(nil, func(r rune) bool { return false }) != -1 //@ diag(`bytes.ContainsFunc`) | ||
_ = strings.IndexFunc("", func(r rune) bool { return false }) != -1 //@ diag(`strings.ContainsFunc`) | ||
} |
11 changes: 11 additions & 0 deletions
11
simple/testdata/src/example.com/CheckStringsContains_go121/contains.go.golden
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,11 @@ | ||
package pkg | ||
|
||
import ( | ||
"bytes" | ||
"strings" | ||
) | ||
|
||
func fn() { | ||
_ = bytes.ContainsFunc(nil, func(r rune) bool { return false }) //@ diag(`bytes.ContainsFunc`) | ||
_ = strings.ContainsFunc("", func(r rune) bool { return false }) //@ diag(`strings.ContainsFunc`) | ||
} |