Skip to content

Commit b2be3e2

Browse files
committed
refactor: replace Split in loops with more efficient SplitSeq
Signed-off-by: youzichuan <youzichuan6@outlook.com>
1 parent 9f177a0 commit b2be3e2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/util/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ func Exit(code int, msg string) {
4747

4848
// entryExists checks if an entry already exists in the content
4949
func entryExists(content, entry string) bool {
50-
lines := strings.Split(strings.TrimSpace(content), "\n")
51-
for _, line := range lines {
50+
lines := strings.SplitSeq(strings.TrimSpace(content), "\n")
51+
for line := range lines {
5252
if strings.TrimSpace(line) == strings.TrimSpace(entry) {
5353
return true
5454
}

0 commit comments

Comments
 (0)