Skip to content

CNF-24070: Use %w error wrapping in fmt.Errorf calls - #70

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
sebrandon1:use-errorf-wrap
May 28, 2026
Merged

CNF-24070: Use %w error wrapping in fmt.Errorf calls#70
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
sebrandon1:use-errorf-wrap

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented May 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace %v with %w for error arguments in all 25 fmt.Errorf calls across 8 files
  • Preserves the error chain so callers can use errors.Is and errors.As for programmatic error handling (Go blog: Working with Errors in Go 1.13)
  • One non-trivial change: reordered arguments in process.go to move err to the final position, since %w must be the last format verb

Jira: 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

Test plan

  • go build ./... passes
  • go test ./... passes
  • make lint passes
  • grep -rn 'fmt.Errorf.*%v' --include='*.go' returns zero matches (excluding tests)

Replace %v with %w for error arguments in all fmt.Errorf calls
to preserve the error chain for callers using errors.Is/As.
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 20, 2026
@openshift-ci-robot

openshift-ci-robot commented May 20, 2026

Copy link
Copy Markdown

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

Details

In response to this:

Summary

  • Replace %v with %w for error arguments in all 25 fmt.Errorf calls across 8 files
  • Preserves the error chain so callers can use errors.Is and errors.As for programmatic error handling (Go blog: Working with Errors in Go 1.13)
  • One non-trivial change: reordered arguments in process.go to move err to the final position, since %w must be the last format verb

Jira: 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)

Test plan

  • go build ./... passes
  • go test ./... passes
  • make lint passes
  • grep -rn 'fmt.Errorf.*%v' --include='*.go' returns zero matches (excluding tests)

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.

@openshift-ci
openshift-ci Bot requested review from rhmdnd and richardsonnick May 20, 2026 18:51
@openshift-ci

openshift-ci Bot commented May 20, 2026

Copy link
Copy Markdown

@sebrandon1: all tests passed!

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

@richardsonnick

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 21, 2026
@richardsonnick

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented May 28, 2026

Copy link
Copy Markdown

[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

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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants