code: func Reindex(root string, overwrite bool, indexConf jsonconfig.Obj) (err error) {
  	// there is newStorage, but that may open a file for writing
  	var s = &storage{root: root}
  	index, err := newIndex(root, indexConf)
  	if err != nil {
  		return err
  	}
  	defer func() {
  		closeErr := index.Close()
  		// just returning the first error - if the index or disk is corrupt
  		// and can't close, it's very likely these two errors are related and
  		// have the same root cause.
  		if err == nil {
  			err = closeErr
  		}
  	}()
  
  	ctx := context.TODO() // TODO(tgulacsi): get the verbosity from context
  	for i := 0; i >= 0; i++ {
  		fh, err := os.Open(s.filename(i))
  		if err != nil {
  			if os.IsNotExist(err) {
  				break
  			}
  			return err
  		}
  		err = s.reindexOne(ctx, index, overwrite, i)
  		fh.Close()
  		if err != nil {
  			return err
  		}
  	}
  	return nil
  }
docs: // Reindex rewrites the index files of the diskpacked .pack files