diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index 09f308564..68198377f 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -268,7 +268,7 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args if checker.IsOrphanedPack(err) { orphanedPacks++ Verbosef("%v\n", err) - } else if _, ok := err.(*checker.ErrLegacyLayout); ok { + } else if err == checker.ErrLegacyLayout { Verbosef("repository still uses the S3 legacy layout\nPlease run `restic migrate s3legacy` to correct this.\n") } else { errorsFound = true diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 54e2f76ba..b2512969e 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -59,11 +59,7 @@ func New(repo restic.Repository, trackUnused bool) *Checker { } // ErrLegacyLayout is returned when the repository uses the S3 legacy layout. -type ErrLegacyLayout struct{} - -func (e *ErrLegacyLayout) Error() string { - return "repository uses S3 legacy layout" -} +var ErrLegacyLayout = errors.New("repository uses S3 legacy layout") // ErrDuplicatePacks is returned when a pack is found in more than one index. type ErrDuplicatePacks struct { @@ -231,7 +227,7 @@ func (c *Checker) Packs(ctx context.Context, errChan chan<- error) { defer close(errChan) if isS3Legacy(c.repo.Backend()) { - errChan <- &ErrLegacyLayout{} + errChan <- ErrLegacyLayout } debug.Log("checking for %d packs", len(c.packs))