Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace calls to %v for error values in fmt.Errorf with %w #2763

Merged
merged 1 commit into from
May 2, 2024
Merged

Conversation

moskyb
Copy link
Contributor

@moskyb moskyb commented May 2, 2024

Description

The %w formatting verb has been available forever[citation needed] now, and it's frustrating to use errors.Is, expecting to find a wrapped error, only to find out that a call to %v in a fmt.Errorf call (instead of %w) has eaten all of the error decoration.

This PR casts a wide brush across the codebase, and attempts to replace many (most? all?) uses of %v for errors in calls to fmt.Errorf with %w, properly wrapping those errors

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go fmt ./...)

@moskyb moskyb requested a review from DrJosh9000 May 2, 2024 07:00
@moskyb moskyb merged commit cd0a068 into main May 2, 2024
1 check passed
@moskyb moskyb deleted the wrap-errors branch May 2, 2024 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants