Replace Exitf with errors.Fatalf

This commit is contained in:
Matthew Holt 2018-08-10 22:15:33 -06:00
parent 6f5b0f3622
commit ac3bd6b2eb

View file

@ -8,6 +8,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"github.com/restic/restic/internal/errors"
"github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/restic"
"github.com/restic/restic/internal/walker" "github.com/restic/restic/internal/walker"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -95,18 +96,18 @@ func runStats(gopts GlobalOptions, args []string) error {
if snapshotIDString == "latest" { if snapshotIDString == "latest" {
sID, err = restic.FindLatestSnapshot(ctx, repo, []string{}, []restic.TagList{}, snapshotByHost) sID, err = restic.FindLatestSnapshot(ctx, repo, []string{}, []restic.TagList{}, snapshotByHost)
if err != nil { if err != nil {
Exitf(1, "latest snapshot for criteria not found: %v", err) return errors.Fatalf("latest snapshot for criteria not found: %v", err)
} }
} else { } else {
sID, err = restic.FindSnapshot(repo, snapshotIDString) sID, err = restic.FindSnapshot(repo, snapshotIDString)
if err != nil { if err != nil {
Exitf(1, "error loading snapshot: %v", err) return errors.Fatalf("error loading snapshot: %v", err)
} }
} }
snapshot, err := restic.LoadSnapshot(ctx, repo, sID) snapshot, err := restic.LoadSnapshot(ctx, repo, sID)
if err != nil { if err != nil {
Exitf(1, "error loading snapshot from repo: %v", err) return errors.Fatalf("error loading snapshot from repo: %v", err)
} }
err = statsWalkSnapshot(ctx, snapshot, repo, stats) err = statsWalkSnapshot(ctx, snapshot, repo, stats)