mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-25 09:01:29 +02:00
19 lines
354 B
Go
19 lines
354 B
Go
package elevate
|
|
|
|
import "strings"
|
|
|
|
// noOutput stands in for a process that said nothing, so that a report of what it
|
|
// said still reads as a sentence.
|
|
const noOutput = "no output"
|
|
|
|
func firstLine(s string) string {
|
|
s = strings.TrimSpace(s)
|
|
if s == "" {
|
|
return noOutput
|
|
}
|
|
if i := strings.IndexByte(s, '\n'); i >= 0 {
|
|
return s[:i]
|
|
}
|
|
return s
|
|
}
|