2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-02 11:46:36 +00:00

Use non-formatting functions of errors for strings

Commands used:

    $ gofmt -w -r 'errors.Fatalf(x) -> errors.Fatal(x)' src
    $ gofmt -w -r 'errors.Errorf(x) -> errors.New(x)' src

Closes #789
This commit is contained in:
Alexander Neumann 2017-02-10 19:39:49 +01:00
parent 073edd914d
commit c8fc789393
11 changed files with 12 additions and 12 deletions

View File

@ -237,7 +237,7 @@ func gatherDevices(items []string) (deviceMap map[uint64]struct{}, err error) {
func readBackupFromStdin(opts BackupOptions, gopts GlobalOptions, args []string) error {
if len(args) != 0 {
return errors.Fatalf("when reading from stdin, no additional files can be specified")
return errors.Fatal("when reading from stdin, no additional files can be specified")
}
if opts.StdinFilename == "" {
@ -321,7 +321,7 @@ func runBackup(opts BackupOptions, gopts GlobalOptions, args []string) error {
// same time
args = append(args, fromfile...)
if len(args) == 0 {
return errors.Fatalf("wrong number of parameters")
return errors.Fatal("wrong number of parameters")
}
target := make([]string, 0, len(args))

View File

@ -30,7 +30,7 @@ func init() {
func runCat(gopts GlobalOptions, args []string) error {
if len(args) < 1 || (args[0] != "masterkey" && args[0] != "config" && len(args) != 2) {
return errors.Fatalf("type or ID not specified")
return errors.Fatal("type or ID not specified")
}
repo, err := OpenRepository(gopts)

View File

@ -168,7 +168,7 @@ func dumpIndexes(repo restic.Repository) error {
func runDump(gopts GlobalOptions, args []string) error {
if len(args) != 1 {
return errors.Fatalf("type not specified")
return errors.Fatal("type not specified")
}
repo, err := OpenRepository(gopts)

View File

@ -148,7 +148,7 @@ func findInSnapshot(repo *repository.Repository, pat findPattern, id restic.ID)
func runFind(opts FindOptions, gopts GlobalOptions, args []string) error {
if len(args) != 1 {
return errors.Fatalf("wrong number of arguments")
return errors.Fatal("wrong number of arguments")
}
var (

View File

@ -121,7 +121,7 @@ func changePassword(gopts GlobalOptions, repo *repository.Repository) error {
func runKey(gopts GlobalOptions, args []string) error {
if len(args) < 1 || (args[0] == "rm" && len(args) != 2) {
return errors.Fatalf("wrong number of arguments")
return errors.Fatal("wrong number of arguments")
}
repo, err := OpenRepository(gopts)

View File

@ -26,7 +26,7 @@ func init() {
func runList(opts GlobalOptions, args []string) error {
if len(args) != 1 {
return errors.Fatalf("type not specified")
return errors.Fatal("type not specified")
}
repo, err := OpenRepository(opts)

View File

@ -86,7 +86,7 @@ func printTree(prefix string, repo *repository.Repository, id restic.ID) error {
func runLs(gopts GlobalOptions, args []string) error {
if len(args) < 1 || len(args) > 2 {
return errors.Fatalf("no snapshot ID given")
return errors.Fatal("no snapshot ID given")
}
repo, err := OpenRepository(gopts)

View File

@ -95,7 +95,7 @@ func umount(mountpoint string) error {
func runMount(opts MountOptions, gopts GlobalOptions, args []string) error {
if len(args) == 0 {
return errors.Fatalf("wrong number of parameters")
return errors.Fatal("wrong number of parameters")
}
mountpoint := args[0]

View File

@ -49,7 +49,7 @@ func init() {
func runRestore(opts RestoreOptions, gopts GlobalOptions, args []string) error {
if len(args) != 1 {
return errors.Fatalf("no snapshot ID specified")
return errors.Fatal("no snapshot ID specified")
}
if opts.Target == "" {

View File

@ -40,7 +40,7 @@ func init() {
func runSnapshots(opts SnapshotOptions, gopts GlobalOptions, args []string) error {
if len(args) != 0 {
return errors.Fatalf("wrong number of arguments")
return errors.Fatal("wrong number of arguments")
}
repo, err := OpenRepository(gopts)

View File

@ -157,7 +157,7 @@ func (be *s3) Load(h restic.Handle, length int, offset int64) (io.ReadCloser, er
if offset > info.Size {
_ = obj.Close()
return nil, errors.Errorf("offset larger than file size")
return nil, errors.New("offset larger than file size")
}
l := int64(length)