github.com/searKing/golang/go@v1.2.74/bytes/buffer.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package bytes 6 7 import "bytes" 8 9 func NewIndent(dst *bytes.Buffer, prefix, indent string, depth int) { 10 dst.WriteString(prefix) 11 for i := 0; i < depth; i++ { 12 dst.WriteString(indent) 13 } 14 } 15 16 func NewLine(dst *bytes.Buffer, prefix, indent string, depth int) { 17 dst.WriteByte('\n') 18 NewIndent(dst, prefix, indent, depth) 19 }