code: func (bg *Reader) Read(p []byte) (int, error) {
  	if bg.err != nil {
  		return 0, bg.err
  	}
  
  	// Discard leading empty blocks. This is an indexing
  	// optimisation to avoid retaining useless members
  	// in a BAI/CSI.
  	for bg.current.len() == 0 {
  		bg.err = bg.nextBlock()
  		if bg.err != nil {
  			return 0, bg.err
  		}
  	}
  
  	bg.lastChunk.Begin = bg.current.txOffset()
  
  	var n int
  	for n < len(p) && bg.err == nil {
  		var _n int
  		_n, bg.err = bg.current.Read(p[n:])
  		n += _n
  		if bg.err == io.EOF {
  			if n == len(p) {
  				bg.err = nil
  				break
  			}
  
  			if bg.Blocked {
  				bg.err = nil
  				bg.lastChunk.End = bg.current.txOffset()
  				return n, io.EOF
  			}
  
  			bg.err = bg.nextBlock()
  			if bg.err != nil {
  				break
  			}
  		}
  	}
  
  	bg.lastChunk.End = bg.current.txOffset()
  	return n, bg.err
  }
docs: // Read implements the io.Reader interface.