find: Address review comments

This commit is contained in:
Michael Eischer 2021-07-06 21:03:35 +02:00
parent a81f34ae47
commit 3442dc87fb
1 changed files with 4 additions and 5 deletions

View File

@ -3,7 +3,6 @@ package main
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"fmt"
"sort" "sort"
"strings" "strings"
"time" "time"
@ -401,7 +400,7 @@ func (f *Finder) findIDs(ctx context.Context, sn *restic.Snapshot) error {
}) })
} }
var errorAllPacksFound = fmt.Errorf("all packs found") var errAllPacksFound = errors.New("all packs found")
// packsToBlobs converts the list of pack IDs to a list of blob IDs that // packsToBlobs converts the list of pack IDs to a list of blob IDs that
// belong to those packs. // belong to those packs.
@ -437,16 +436,16 @@ func (f *Finder) packsToBlobs(ctx context.Context, packs []string) error {
} }
// Stop searching when all packs have been found // Stop searching when all packs have been found
if len(packIDs) == 0 { if len(packIDs) == 0 {
return errorAllPacksFound return errAllPacksFound
} }
return nil return nil
}) })
if err != nil && err != errorAllPacksFound { if err != nil && err != errAllPacksFound {
return err return err
} }
if err != errorAllPacksFound { if err != errAllPacksFound {
// try to resolve unknown pack ids from the index // try to resolve unknown pack ids from the index
packIDs = f.indexPacksToBlobs(ctx, packIDs) packIDs = f.indexPacksToBlobs(ctx, packIDs)
} }