Skip to content

CNF-23307: Standardize error wrapping with %w across the codebase - #482

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift-kni:mainfrom
sebrandon1:standardize-error-wrapping
May 13, 2026
Merged

CNF-23307: Standardize error wrapping with %w across the codebase#482
openshift-merge-bot[bot] merged 1 commit into
openshift-kni:mainfrom
sebrandon1:standardize-error-wrapping

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace %s and %v with %w in all fmt.Errorf calls to enable proper error chain unwrapping via errors.Is() and errors.As()
  • 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

Files 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

Test plan

  • make lint passes clean
  • make test passes (all unit tests green)
  • CI checks pass

Jira: CNF-23307

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
@openshift-ci
openshift-ci Bot requested review from SchSeba and yuvalk April 28, 2026 17:47
@aabughosh

Copy link
Copy Markdown
Collaborator

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 30, 2026
@sebrandon1 sebrandon1 changed the title Standardize error wrapping with %w across the codebase CNF-23307: Standardize error wrapping with %w across the codebase May 1, 2026
@openshift-ci-robot

openshift-ci-robot commented May 1, 2026

Copy link
Copy Markdown

@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.

Details

In response to this:

Summary

  • Replace %s and %v with %w in all fmt.Errorf calls to enable proper error chain unwrapping via errors.Is() and errors.As()
  • 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

Files 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)

Test plan

  • make lint passes clean
  • make test passes (all unit tests green)
  • CI checks pass

Jira: CNF-23307

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.

@oribon

oribon commented May 13, 2026

Copy link
Copy Markdown
Member

/approve

@openshift-ci

openshift-ci Bot commented May 13, 2026

Copy link
Copy Markdown

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants