Skip to content

Enable usetesting lints#4366

Merged
stefanvanburen merged 1 commit intomainfrom
svanburen/usetesting
Mar 3, 2026
Merged

Enable usetesting lints#4366
stefanvanburen merged 1 commit intomainfrom
svanburen/usetesting

Conversation

@stefanvanburen
Copy link
Member

Opts us into avoiding context.Background / context.TODO in tests in favor of t.Context, which is nearly always the context you want to use in tests.

Has come up in a couple separate PR reviews (e.g. #4365), so figured I may as well update this everywhere.

Similar to bufbuild/plugins#2282.

Ref: https://golangci-lint.run/docs/linters/configuration/#usetesting

Opts us into avoiding `context.Background` / `context.TODO` in tests in
favor of [`t.Context`][1], which is nearly always the context you want
to use in tests.

Has come up in a couple separate PR reviews (e.g. #4365), so figured
I may as well update this everywhere.

Similar to bufbuild/plugins#2282.

Ref: https://golangci-lint.run/docs/linters/configuration/#usetesting

[1]: https://pkg.go.dev/testing#T.Context
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMar 3, 2026, 6:04 PM

@stefanvanburen stefanvanburen merged commit 6cf129d into main Mar 3, 2026
12 checks passed
@stefanvanburen stefanvanburen deleted the svanburen/usetesting branch March 3, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants