Skip to content

proposal: testing: should Context() have a deadline? #74631

@teo-tsirpanis

Description

@teo-tsirpanis

Proposal Details

Go 1.24 added a standard way to get a context inside a test, however even though there is a function to get the Deadline of a test, its Context does not have this deadline set. Should it?

In some tests of mine we've been setting a timeout of 20 seconds for HTTP requests, which makes debugging challenging if you forget to temporarily remove the timeout. Having a uniform and unbotrusive way of flowing the deadline to tests would greatly help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LanguageProposalIssues describing a requested change to the Go language specification.Proposal

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions