checker: Make ErrLegacyLayout a value, not a type

This commit is contained in:
greatroar 2022-11-23 21:12:06 +01:00
parent d9002f050e
commit 1678392a6d
2 changed files with 3 additions and 7 deletions

View file

@ -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

View file

@ -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))