readwriteseeker/readwriteseeker.go
func (rws *ReadWriteSeeker) Write(p []byte) (n int, err error) {
	minCap := rws.pos + len(p)
	if minCap > cap(rws.buf) { // Make sure buf has enough capacity:
		buf2 := make([]byte, len(rws.buf), minCap+len(p)) // add some extra
		copy(buf2, rws.buf)
		rws.buf = buf2
	}
	if minCap > len(rws.buf) {
		rws.buf = rws.buf[:minCap]
	}
	copy(rws.buf[rws.pos:], p)
	rws.pos += len(p)
	return len(p), nil
}
func (rws *ReadWriteSeeker) Write(p []byte) (n int, err error) {
	minCap := rws.pos + len(p)
	if minCap > cap(rws.buf) { // Make sure buf has enough capacity:
		buf2 := make([]byte, len(rws.buf), minCap+len(p)) // add some extra
		copy(buf2, rws.buf)
		rws.buf = buf2
	}
	if minCap > len(rws.buf) {
		rws.buf = rws.buf[:minCap]
	}
	copy(rws.buf[rws.pos:], p)
	rws.pos += len(p)
	return len(p), nil
}
// Write implements the io.Writer interface