func leadingWhitespace(buf []byte) []byte {
	leadingSize := 0
	iterBuf := buf
	for len(iterBuf) > 0 {
		r, size := utf8.DecodeRune(iterBuf)
		// protobuf strings must always be valid UTF8
		// https://developers.google.com/protocol-buffers/docs/proto3#scalar
		// Additionally, utf8.RuneError is not a space so we'll terminate
		// and return the leading, valid, UTF8 whitespace sequence.
		if !unicode.IsSpace(r) {
			out := make([]byte, leadingSize)
			copy(out, buf)
			return out
		}
		leadingSize += size
		iterBuf = iterBuf[size:]
	}
	return buf
}
// leadingWhitespace iterates through the given string,
// and returns the leading whitespace substring, if any,
// respecting utf-8 encoding.
//
//  leadingWhitespace("\u205F   foo ") -> "\u205F   "
leadingWhitespace iterates through the given string,
and returns the leading whitespace substring, if any,
respecting utf-8 encoding.


// leadingWhitespace iterates through the given string // and returns the leading whitespace substring if any // respecting utf - 8 encoding . // // leadingWhitespace ( " \ u205F foo " ) - > " \ u205F "
func leadingWhitespace(buf []byte) []byte {
	leadingSize := 0
	iterBuf := buf
	for len(iterBuf) > 0 {
		r, size := utf8.DecodeRune(iterBuf)
		if !unicode.IsSpace(r) {
			out := make([]byte, leadingSize)
			copy(out, buf)
			return out
		}
		leadingSize += size
		iterBuf = iterBuf[size:]
	}
	return buf
}
func leadingWhitespace ( buf [ ] byte ) [ ] byte { leadingSize := 0 iterBuf := buf for len ( iterBuf ) > 0 { r , size := utf8 . DecodeRune ( iterBuf ) if ! unicode . IsSpace ( r ) { out := make ( [ ] byte , leadingSize ) copy ( out , buf ) return out } leadingSize += size iterBuf = iterBuf [ size : ] } return buf }
leadingWhitespace iterates through the given string,
and returns the leading whitespace substring, if any,
respecting utf-8 encoding.
leadingWhitespace iterates through the given string and returns the leading whitespace substring if any respecting utf - 8 encoding .
// protobuf strings must always be valid UTF8 // https://developers.google.com/protocol-buffers/docs/proto3#scalar // Additionally, utf8.RuneError is not a space so we'll terminate // and return the leading, valid, UTF8 whitespace sequence.