all: Tweak error creation (#6391)

- In the few places where we wrap errors, use the new Go 1.13 "%w"
  construction instead of %s or %v.

- Where we create errors with constant strings, consistently use
  errors.New and not fmt.Errorf.

- Remove capitalization from errors in the few places where we had that.
This commit is contained in:
Jakob Borg
2020-03-03 22:40:00 +01:00
committed by GitHub
parent eddc8d3ff2
commit dd92b2b8f4
30 changed files with 67 additions and 60 deletions
+3 -3
View File
@@ -265,7 +265,7 @@ func scSyncAndCompare(p []*rc.Process, expected [][]fileInfo) error {
return err
}
if err := compareDirectoryContents(actual, expected[0]); err != nil {
return fmt.Errorf("%s: %v", dir, err)
return fmt.Errorf("%s: %w", dir, err)
}
}
@@ -276,7 +276,7 @@ func scSyncAndCompare(p []*rc.Process, expected [][]fileInfo) error {
return err
}
if err := compareDirectoryContents(actual, expected[1]); err != nil {
return fmt.Errorf("%s: %v", dir, err)
return fmt.Errorf("%s: %w", dir, err)
}
}
}
@@ -288,7 +288,7 @@ func scSyncAndCompare(p []*rc.Process, expected [][]fileInfo) error {
return err
}
if err := compareDirectoryContents(actual, expected[2]); err != nil {
return fmt.Errorf("%s: %v", dir, err)
return fmt.Errorf("%s: %w", dir, err)
}
}
}