Skip to content

Commit ff237a9

Browse files
committed
Use strings.SplitSeq in lineWithPrefix (modernize lint)
Range over strings.SplitSeq instead of strings.Split: the seq variant iterates without allocating the intermediate slice, clearing the golangci-lint modernize/stringsseq finding. Co-authored-by: Isaac
1 parent aaad18d commit ff237a9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

libs/localenv/uv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const (
171171
// lineWithPrefix returns the trimmed remainder of the first line in out that
172172
// starts with prefix, and whether such a line was found.
173173
func lineWithPrefix(out, prefix string) (string, bool) {
174-
for _, line := range strings.Split(out, "\n") {
174+
for line := range strings.SplitSeq(out, "\n") {
175175
line = strings.TrimSpace(line)
176176
if after, ok := strings.CutPrefix(line, prefix); ok {
177177
return strings.TrimSpace(after), true

0 commit comments

Comments
 (0)