CNF-23307: Standardize error wrapping with %w across the codebase - #482
Conversation
Replace %s and %v with %w in all fmt.Errorf calls to enable proper error chain unwrapping via errors.Is() and errors.As(). This is the standard Go practice since Go 1.13. 30 lines across 9 files. Each change is a single-character format verb substitution with no behavioral changes. log.Errorf calls (logrus) are left as-is since logrus does not support %w. Jira: CNF-23307
|
/lgtm |
|
@sebrandon1: This pull request references CNF-23307 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. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: oribon, 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
%sand%vwith%win allfmt.Errorfcalls to enable proper error chain unwrapping viaerrors.Is()anderrors.As()log.Errorfcalls (logrus) are left as-is since logrus does not support%wFiles changed
cmd/generate/generate.go(10)pkg/commatrix-creator/commatrix.go(5)pkg/utils/utils.go(5)pkg/firewall/machineconfig.go(3)pkg/endpointslices/endpointslices.go(3)pkg/types/types.go(1)pkg/matrix-diff/matrix-diff.go(1)test/pkg/firewall/firewall.go(1)test/pkg/cluster/cluster.go(1)Related to
%werror wrapping in certsuite (open)%werror wrapping in tls-scanner (merged)%werror wrapping in crc (merged)Test plan
make lintpasses cleanmake testpasses (all unit tests green)Jira: CNF-23307