Skip to content

Conversation

@alex-cobas
Copy link
Contributor

@alex-cobas alex-cobas commented Jun 2, 2025

Changes

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 the test has completed.

Fixes #8805

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesnt merit a release note. labels Jun 2, 2025
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 2, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 2, 2025
@alex-cobas
Copy link
Contributor Author

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label Jun 2, 2025
@waveywaves
Copy link
Member

/ok-to-test

@tekton-robot tekton-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jun 3, 2025
@waveywaves
Copy link
Member

@alex-cobas please sign the CLA when you get the chance

@alex-cobas alex-cobas force-pushed the fix-golangci-lint-usetesing branch from 16ba051 to 8b081b0 Compare June 3, 2025 17:12
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 3, 2025
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/entrypoint/runner.go 86.2% 84.5% -1.7

@alex-cobas alex-cobas force-pushed the fix-golangci-lint-usetesing branch from 8b081b0 to c289804 Compare June 3, 2025 20:05
@alex-cobas alex-cobas marked this pull request as ready for review June 3, 2025 20:11
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 3, 2025
@tekton-robot tekton-robot requested review from dibyom and jerop June 3, 2025 20:11
@waveywaves
Copy link
Member

/ok-to-test

@alex-cobas
Copy link
Contributor Author

/retest

@alex-cobas
Copy link
Contributor Author

@waveywaves what’s the correct way to initiate the GitHub Actions checks if they haven’t started automatically?

@AlanGreene
Copy link
Member

AlanGreene commented Jun 4, 2025

image
A maintainer of this repo will need to approve the GitHub Actions workflows before they run.
The /ok-to-test only applies to the Prow-based checks, @waveywaves

@waveywaves
Copy link
Member

/retest

@alex-cobas
Copy link
Contributor Author

@waveywaves the last run (https://github.com/tektoncd/pipeline/actions/runs/15400505687) didn’t show any failed Actions, and the /retest command doesn’t appear to trigger a new run 🤷‍♂️

@alex-cobas
Copy link
Contributor Author

/test all

@tekton-robot
Copy link
Collaborator

@alex-cobas: No presubmit jobs available for tektoncd/pipeline@main

In response to this:

/test all

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.

@alex-cobas
Copy link
Contributor Author

@afrittoli @pritidesai @dibyom @jerop
Please, take a look when you get a chance. Thank you!

@tekton-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jun 11, 2025
@alex-cobas alex-cobas force-pushed the fix-golangci-lint-usetesing branch from c289804 to f68002b Compare June 11, 2025 14:04
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 11, 2025
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]>
@alex-cobas alex-cobas force-pushed the fix-golangci-lint-usetesing branch from 3ce4e93 to bf5bd42 Compare June 11, 2025 15:35
@vdemeester
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 11, 2025
@tekton-robot tekton-robot merged commit c12a36e into tektoncd:main Jun 11, 2025
20 checks passed
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. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesnt merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Enable golangci-lint linter usetesing context checks for go >= 1.24.

5 participants