CNF-24070: Use %w error wrapping in fmt.Errorf calls - #70
Conversation
Replace %v with %w for error arguments in all fmt.Errorf calls to preserve the error chain for callers using errors.Is/As.
|
@sebrandon1: This pull request references CNF-24070 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@sebrandon1: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/lgtm |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: richardsonnick, sebrandon1 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
%vwith%wfor error arguments in all 25fmt.Errorfcalls across 8 fileserrors.Isanderrors.Asfor programmatic error handling (Go blog: Working with Errors in Go 1.13)process.goto moveerrto the final position, since%wmust be the last format verbJira: CNF-24070
Files changed (8)
k8s:
client.go(5),process.go(2),tls.go(2),component.go(1)output:
csv.go(6),junit.go(4),json.go(3)timing:
timing.go(2)Related to
%werror wrapping in certsuite (open)%werror wrapping in commatrix (merged)%werror wrapping in crc (merged)Test plan
go build ./...passesgo test ./...passesmake lintpassesgrep -rn 'fmt.Errorf.*%v' --include='*.go'returns zero matches (excluding tests)