code: func (cr *ChainReader) Read(p []byte) (int, error) {
  	if len(p) == 0 {
  		return 0, nil
  	}
  
  	consumed := 0
  	defer func() {
  		*cr = (*cr)[consumed:]
  	}()
  
  	total := 0
  	for idx, source := range *cr {
  		if source == nil {
  			consumed++
  			continue
  		}
  
  		count, err := source.Read(p)
  		total += count
  		if err == io.EOF {
  			(*cr)[idx] = nil
  			consumed++
  		} else if err != nil {
  			return total, err
  		}
  
  		p = p[count:]
  		if len(p) == 0 {
  			return total, nil
  		}
  	}
  	return total, io.EOF
  }
docs: // Read implements io.Reader.