code: func sliceForAppend(in []byte, n int) (head, tail []byte) {
  	if total := len(in) + n; cap(in) >= total {
  		head = in[:total]
  	} else {
  		head = make([]byte, total)
  		copy(head, in)
  	}
  	tail = head[len(in):]
  	return
  }
docs: // sliceForAppend takes a slice and a requested number of bytes. It returns a
  // slice with the contents of the given slice followed by that many bytes and a
  // second slice that aliases into it and contains only the extra bytes. If the
  // original slice has sufficient capacity then no allocation is performed.