reader.go
func (f *packedFileReader) next() (*fileBlockHeader, error) {
	if f.h != nil {
		// skip to last block in current file
		for !f.h.last {
			// discard remaining block data
			if _, err := io.Copy(ioutil.Discard, f.r); err != nil {
				return nil, err
			}
			if err := f.nextBlockInFile(); err != nil {
				return nil, err
			}
		}
		// discard last block data
		if _, err := io.Copy(ioutil.Discard, f.r); err != nil {
			return nil, err
		}
	}
	var err error
	f.h, err = f.r.next() // get next file block
	if err != nil {
		if err == errArchiveEnd {
			return nil, io.EOF
		}
		return nil, err
	}
	if !f.h.first {
		return nil, errInvalidFileBlock
	}
	return f.h, nil
}
func (f *packedFileReader) next() (*fileBlockHeader, error) {
	if f.h != nil {
		// skip to last block in current file
		for !f.h.last {
			// discard remaining block data
			if _, err := io.Copy(ioutil.Discard, f.r); err != nil {
				return nil, err
			}
			if err := f.nextBlockInFile(); err != nil {
				return nil, err
			}
		}
		// discard last block data
		if _, err := io.Copy(ioutil.Discard, f.r); err != nil {
			return nil, err
		}
	}
	var err error
	f.h, err = f.r.next() // get next file block
	if err != nil {
		if err == errArchiveEnd {
			return nil, io.EOF
		}
		return nil, err
	}
	if !f.h.first {
		return nil, errInvalidFileBlock
	}
	return f.h, nil
}
// next advances to the next packed file in the RAR archive.