pkg/utils/indent.go
package utils
func Indent(s, prefix string) string {
return string(IndentBytes([]byte(s), []byte(prefix)))
}
func IndentBytes(b, prefix []byte) []byte {
var res []byte
bol := true
for _, c := range b {
if bol && c != '\n' {
res = append(res, prefix...)
}
res = append(res, c)
bol = c == '\n'
}
return res
}