Refactor logLines to SplitByNewline, deduplicate

This commit is contained in:
Benjamin A. Petersen
2024-03-18 12:05:21 -04:00
parent 5c1fa6d52c
commit 0467e5c1d5
7 changed files with 24 additions and 39 deletions

View File

@@ -0,0 +1,14 @@
// Copyright 2024 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package stringutil
import "strings"
func SplitByNewline(logs string) []string {
if len(logs) == 0 {
return nil
}
return strings.Split(strings.TrimSpace(logs), "\n")
}