2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-19 09:12:22 +00:00

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) { if checker.IsOrphanedPack(err) {
orphanedPacks++ orphanedPacks++
Verbosef("%v\n", err) 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") Verbosef("repository still uses the S3 legacy layout\nPlease run `restic migrate s3legacy` to correct this.\n")
} else { } else {
errorsFound = true 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. // ErrLegacyLayout is returned when the repository uses the S3 legacy layout.
type ErrLegacyLayout struct{} var ErrLegacyLayout = errors.New("repository uses S3 legacy layout")
func (e *ErrLegacyLayout) Error() string {
return "repository uses S3 legacy layout"
}
// ErrDuplicatePacks is returned when a pack is found in more than one index. // ErrDuplicatePacks is returned when a pack is found in more than one index.
type ErrDuplicatePacks struct { type ErrDuplicatePacks struct {
@ -231,7 +227,7 @@ func (c *Checker) Packs(ctx context.Context, errChan chan<- error) {
defer close(errChan) defer close(errChan)
if isS3Legacy(c.repo.Backend()) { if isS3Legacy(c.repo.Backend()) {
errChan <- &ErrLegacyLayout{} errChan <- ErrLegacyLayout
} }
debug.Log("checking for %d packs", len(c.packs)) debug.Log("checking for %d packs", len(c.packs))