mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-03 00:57:52 +02:00
Enable intrange linter, and fix warnings
This commit is contained in:
@ -25,7 +25,7 @@ type ColumnConfig struct {
|
||||
func StringWidth(s string) int {
|
||||
// We are intentionally not using a range loop here, because that would
|
||||
// convert the characters to runes, which is unnecessary work in this case.
|
||||
for i := 0; i < len(s); i++ {
|
||||
for i := range len(s) {
|
||||
if s[i] > unicode.MaxASCII {
|
||||
return runewidth.StringWidth(s)
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func FindSubstringsFrom(pattern string, data fuzzy.Source) fuzzy.Matches {
|
||||
result := fuzzy.Matches{}
|
||||
|
||||
outer:
|
||||
for i := 0; i < data.Len(); i++ {
|
||||
for i := range data.Len() {
|
||||
s := data.String(i)
|
||||
for _, sub := range substrings {
|
||||
if !CaseAwareContains(s, sub) {
|
||||
|
@ -48,12 +48,12 @@ func TestThreadSafeMapConcurrentReadWrite(t *testing.T) {
|
||||
m := NewThreadSafeMap[int, int]()
|
||||
|
||||
go func() {
|
||||
for i := 0; i < 10000; i++ {
|
||||
for range 10000 {
|
||||
m.Set(0, 0)
|
||||
}
|
||||
}()
|
||||
|
||||
for i := 0; i < 10000; i++ {
|
||||
for range 10000 {
|
||||
m.Get(0)
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ func walk(node *yaml.Node, path string, callback func(*yaml.Node, string)) error
|
||||
}
|
||||
}
|
||||
case yaml.SequenceNode:
|
||||
for i := 0; i < len(node.Content); i++ {
|
||||
for i := range len(node.Content) {
|
||||
childPath := fmt.Sprintf("%s[%d]", path, i)
|
||||
err := walk(node.Content[i], childPath, callback)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user