code: func writeFully(w io.Writer, data []byte) error {
  	offset := 0
  	for offset < len(data) {
  		n, err := w.Write(data[offset:])
  		if err != nil {
  			return errors.WrapErrorf(err, errors.NetworkError, "error writing %d bytes at offset %d", len(data), offset)
  		}
  		offset += n
  	}
  	return nil
  }
docs: // writeFully writes all of data to w.
  // Inverse of io.ReadFully().