code: func (s *storage) openAllPacks() error {
  	debug.Println("diskpacked: openAllPacks")
  	n := 0
  	for {
  		err := s.openForRead(n)
  		if os.IsNotExist(err) {
  			break
  		}
  		if err != nil {
  			return err
  		}
  		n++
  	}
  
  	if n == 0 {
  		// If no pack files are found, we create one open for read and write.
  		return s.nextPack()
  	}
  
  	// If 1 or more pack files are found, open the last one read and write.
  	return s.openForWrite(n - 1)
  }
docs: // openAllPacks opens read-only each pack file in s.root, populating s.fds.
  // The latest pack file will also have a writable handle opened.
  // This function is not thread safe, s.mu should be locked by the caller.