Skip to content

Commit 52ba836

Browse files
authored
Merge pull request cli#11805 from juejinyuxitu/FieldsFuncSeq
refactor: use strings.FieldsFuncSeq to reduce memory allocations
2 parents a9efc8d + f5cf156 commit 52ba836

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/cmd/gist/list/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func printContent(io *iostreams.IOStreams, gists []shared.Gist, filter *regexp.R
250250
}
251251

252252
if file.Content != "" {
253-
for _, line := range strings.FieldsFunc(file.Content, split) {
253+
for line := range strings.FieldsFuncSeq(file.Content, split) {
254254
if filter.MatchString(line) {
255255
if line, err = highlightMatch(line, filter, &matched, normal, cs.Highlight); err != nil {
256256
return err

0 commit comments

Comments
 (0)