code: func (s *Scanner) Header() (version, objects uint32, err error) {
  	if s.version != 0 {
  		return s.version, s.objects, nil
  	}
  
  	sig, err := s.readSignature()
  	if err != nil {
  		if err == io.EOF {
  			err = ErrEmptyPackfile
  		}
  
  		return
  	}
  
  	if !s.isValidSignature(sig) {
  		err = ErrBadSignature
  		return
  	}
  
  	version, err = s.readVersion()
  	s.version = version
  	if err != nil {
  		return
  	}
  
  	if !s.isSupportedVersion(version) {
  		err = ErrUnsupportedVersion.AddDetails("%d", version)
  		return
  	}
  
  	objects, err = s.readCount()
  	s.objects = objects
  	return
  }
docs: // Header reads the whole packfile header (signature, version and object count).
  // It returns the version and the object count and performs checks on the
  // validity of the signature and the version fields.