Skip to content

Commit

Permalink
Wrapped errors correctly with %w directive
Browse files Browse the repository at this point in the history
  • Loading branch information
CGA1123 committed Sep 4, 2021
1 parent fcedd6a commit 86d1943
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions cmd/slugcmplr/test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func setupApp(t *testing.T, h *heroku.Service, fixture string) (string, string,

tarball, err := slugcmplr.Targz(dir, tmp.Name())
if err != nil {
return "", "", fmt.Errorf("failed tarring directory: %v", err)
return "", "", fmt.Errorf("failed tarring directory: %w", err)
}

src, err := h.SourceCreate(context.Background())
Expand All @@ -106,7 +106,7 @@ func setupApp(t *testing.T, h *heroku.Service, fixture string) (string, string,
src.SourceBlob.PutURL,
tarball.Path,
); err != nil {
return "", "", fmt.Errorf("failed to upload test app: %v", err)
return "", "", fmt.Errorf("failed to upload test app: %w", err)
}

app, err := h.AppSetupCreate(context.Background(), heroku.AppSetupCreateOpts{
Expand All @@ -120,7 +120,7 @@ func setupApp(t *testing.T, h *heroku.Service, fixture string) (string, string,
},
})
if err != nil {
return "", "", fmt.Errorf("failed to create application: %v", err)
return "", "", fmt.Errorf("failed to create application: %w", err)
}

t.Logf("created app for %v (%v)", fixture, app.App.Name)
Expand Down Expand Up @@ -148,7 +148,7 @@ func waitForBuild(t *testing.T, h *heroku.Service, app *heroku.AppSetup) (*herok

info, err := h.AppSetupInfo(context.Background(), id)
if err != nil {
return nil, fmt.Errorf("(%v) error fetching app info: %v", name, err)
return nil, fmt.Errorf("(%v) error fetching app info: %w", name, err)
}

t.Logf("(%v) status: %v", name, info.Status)
Expand Down
4 changes: 2 additions & 2 deletions compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (c *CompileCmd) Execute(ctx context.Context, out Outputter) (*CompileResult

pf, err := os.Open(filepath.Join(c.BuildDir, buildpack.AppDir, "Procfile"))
if err != nil {
return nil, fmt.Errorf("error opening Procfile: %v", err)
return nil, fmt.Errorf("error opening Procfile: %w", err)
}
defer pf.Close() // nolint:errcheck

Expand All @@ -79,7 +79,7 @@ func (c *CompileCmd) Execute(ctx context.Context, out Outputter) (*CompileResult
filepath.Join(c.BuildDir, "app.tgz"),
)
if err != nil {
return nil, fmt.Errorf("error creating tarball: %v", err)
return nil, fmt.Errorf("error creating tarball: %w", err)
}

return &CompileResult{
Expand Down
2 changes: 1 addition & 1 deletion prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (p *PrepareCmd) Execute(ctx context.Context, out Outputter) (*PrepareResult
// exists.
ignore, err := slugignore.ForDirectory(p.SourceDir)
if err != nil {
return nil, fmt.Errorf("failed to read .slugignore: %v", err)
return nil, fmt.Errorf("failed to read .slugignore: %w", err)
}

if err := copy.Copy(p.SourceDir, appDir, copy.Options{
Expand Down

0 comments on commit 86d1943

Please sign in to comment.