Skip to content

Commit 895fc05

Browse files
committed
run modernize
1 parent e87b6b3 commit 895fc05

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

test/errorcontains/capture.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func Summary(inputPath string) (map[string]int, error) {
208208

209209
// Count occurrences of each error type
210210
counts := make(map[string]int)
211-
for _, line := range strings.Split(string(data), "\n") {
211+
for line := range strings.SplitSeq(string(data), "\n") {
212212
if line == "" {
213213
continue
214214
}

test/errorcontains/cmd/aggregate/main.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"fmt"
2525
"os"
2626
"path/filepath"
27+
"slices"
2728
"sort"
2829
"strings"
2930

@@ -176,7 +177,7 @@ func readAndAggregate(filename string) (map[string]*CallSite, error) {
176177
}
177178

178179
// Add unique samples (up to 10 for LCS computation)
179-
if len(site.Samples) < 10 && !containsString(site.Samples, entry.ErrorMsg) {
180+
if len(site.Samples) < 10 && !slices.Contains(site.Samples, entry.ErrorMsg) {
180181
site.Samples = append(site.Samples, entry.ErrorMsg)
181182
}
182183
}
@@ -195,15 +196,6 @@ func normalizePath(path string) string {
195196
return filepath.Base(path)
196197
}
197198

198-
func containsString(slice []string, s string) bool {
199-
for _, item := range slice {
200-
if item == s {
201-
return true
202-
}
203-
}
204-
return false
205-
}
206-
207199
// longestCommonSubstring finds the longest substring common to all strings.
208200
func longestCommonSubstring(strs []string) string {
209201
if len(strs) == 0 {

0 commit comments

Comments
 (0)