code: func (d *defrag) writeConsecutive(dst io.Writer, start *fragment) (
  	int64, error) {
  	// Write out the explicitly passed fragment.
  	written, err := start.contents.WriteTo(dst)
  	if err != nil {
  		return int64(written), err
  	}
  
  	if err := start.contents.Close(); err != nil {
  		return int64(written), err
  	}
  
  	d.lastWritten += 1
  
  	// Write as many contiguous bytes as possible.
  	for {
  		// Check for sent cancellation between each fragment
  		// to abort earlier, when possible.
  		select {
  		case d.cancellation = <-d.cancelNotify:
  			d.future = nil
  			return 0, d.cancellation
  		default:
  		}
  
  		next := d.lastWritten + 1
  		if frag, ok := d.future[next]; ok {
  			// Found a contiguous segment to write.
  			delete(d.future, next)
  			n, err := frag.contents.WriteTo(dst)
  			written += n
  			defer frag.contents.Close()
  			if err != nil {
  				return int64(written), err
  			}
  
  			d.lastWritten = next
  		} else {
  			// No contiguous segment found.
  			return int64(written), nil
  		}
  	}
  }
docs: // Write a contiguous swathe of fragments, starting at the work
  // ordinal in 'start'.