template/funcs.go
func indent(spaces int, s string) (string, error) {
	if spaces < 0 {
		return "", fmt.Errorf("indent value must be a positive integer")
	}
	var output, prefix []byte
	var sp bool
	var size int
	prefix = []byte(strings.Repeat(" ", spaces))
	sp = true
	for _, c := range []byte(s) {
		if sp && c != '\n' {
			output = append(output, prefix...)
			size += spaces
		}
		output = append(output, c)
		sp = c == '\n'
		size++
	}
	return string(output[:size]), nil
}
func indent(spaces int, s string) (string, error) {
	if spaces < 0 {
		return "", fmt.Errorf("indent value must be a positive integer")
	}
	var output, prefix []byte
	var sp bool
	var size int
	prefix = []byte(strings.Repeat(" ", spaces))
	sp = true
	for _, c := range []byte(s) {
		if sp && c != '\n' {
			output = append(output, prefix...)
			size += spaces
		}
		output = append(output, c)
		sp = c == '\n'
		size++
	}
	return string(output[:size]), nil
}
func indent ( spaces int , s string ) ( string , error ) { if spaces < 0 { return " " , fmt . Errorf ( " " ) } var output , prefix [ ] byte var sp bool var size int prefix = [ ] byte ( strings . Repeat ( " " , spaces ) ) sp = true for _ , c := range [ ] byte ( s ) { if sp && c != '\n' { output = append ( output , prefix ... ) size += spaces } output = append ( output , c ) sp = c == '\n' size ++ } return string ( output [ : size ] ) , nil }
// Indent prefixes each line of a string with the specified number of spaces
Indent prefixes each line of a string with the specified number of spaces