mirror of
https://github.com/holos-run/holos.git
synced 2026-04-06 01:25:02 +00:00
10 lines
192 B
Go
10 lines
192 B
Go
package util
|
|
|
|
// EnsureNewline adds a trailing newline if not already there.
|
|
func EnsureNewline(b []byte) []byte {
|
|
if len(b) > 0 && b[len(b)-1] != '\n' {
|
|
b = append(b, '\n')
|
|
}
|
|
return b
|
|
}
|