-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(lint): resolve golangci-lint errors in testing context #8810
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
fix(lint): resolve golangci-lint errors in testing context #8810
Conversation
|
|
|
/kind misc |
|
/ok-to-test |
|
@alex-cobas please sign the CLA when you get the chance |
16ba051 to
8b081b0
Compare
|
The following is the coverage report on the affected files.
|
8b081b0 to
c289804
Compare
|
/ok-to-test |
|
/retest |
|
@waveywaves what’s the correct way to initiate the GitHub Actions checks if they haven’t started automatically? |
|
|
|
/retest |
|
@waveywaves the last run (https://github.com/tektoncd/pipeline/actions/runs/15400505687) didn’t show any failed Actions, and the |
|
/test all |
|
@alex-cobas: No presubmit jobs available for tektoncd/pipeline@main In 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 kubernetes/test-infra repository. |
|
@afrittoli @pritidesai @dibyom @jerop |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
c289804 to
f68002b
Compare
Since Go 1.24, the golangci-lint linter 'usetesing' reports errors when "context.Background()" or "context.TODO()" are used in tests. This commit updates the codebase to use "t.Context()" as recommended by Go 1.24 release documentation. Refactor some 'TestRealWaiter*' functions to send errors through a 'chan error' instead of calling 't.Errorf' inside goroutines. This ensures that all logging and test assertions occur in the main test thread to avoid panics caused by logging after test has completed. Signed-off-by: Alexander Cobas Rodríguez <[email protected]>
3ce4e93 to
bf5bd42
Compare
|
/lgtm |

Changes
Since Go 1.24, the golangci-lint linter
usetesingreports errors whencontext.Background()orcontext.TODO()are used in tests. This commit updates the codebase to uset.Context()as recommended by Go 1.24 release documentation.Refactor some
TestRealWaiter*functions to send errors through achan errorinstead of callingt.Errorfinside goroutines. This ensures that all logging and test assertions occur in the main test thread to avoid panics caused by logging after the test has completed.Fixes #8805
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes