Skip to content

Commit

Permalink
Avoid %w in fatal errors
Browse files Browse the repository at this point in the history
go vet doesn't like `%w` (wrap error) in format strings for fatal
errors. This seems picky, but that's its job.
  • Loading branch information
squaremo committed May 26, 2020
1 parent a78b6ba commit 7663123
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/testfiles/rebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
func mustParseRef(img string) name.Reference {
ref, err := name.ParseReference(img)
if err != nil {
log.Fatalf("could not parse reference from %q: %w", img, err)
log.Fatalf("could not parse reference from %q: %s", img, err)
}
return ref
}
Expand Down Expand Up @@ -51,16 +51,16 @@ func main() {
image := (*out)[:len(*out)-4] + ":latest"
newTag, err := name.NewTag(image)
if err != nil {
log.Fatalf("could not create image ref %q: %w", image, err)
log.Fatalf("could not create image ref %q: %s", image, err)
}
f, err := os.Create(*out)
if err != nil {
log.Fatalf("could not create file %q: %w", *out, err)
log.Fatalf("could not create file %q: %s", *out, err)
}
defer f.Close()

if err := tarball.Write(newTag, img, f); err != nil {
log.Fatalf("could not write image to %v: %w", *out, err)
log.Fatalf("could not write image to %v: %s", *out, err)
}

digest, err := img.Digest()
Expand Down

0 comments on commit 7663123

Please sign in to comment.