Skip to content

Conversation

rolinh
Copy link
Member

@rolinh rolinh commented Sep 17, 2025

As stated in the time package documentation, The issue highlighted by the timeafter linter is no longer a concern with Go versions >= 1.23:

Before Go 1.23, this documentation warned that the underlying Timer
would not be recovered by the garbage collector until the timer fired,
and that if efficiency was a concern, code should use NewTimer instead
and call Timer.Stop if the timer is no longer needed. As of Go 1.23,
the garbage collector can recover unreferenced, unstopped timers.
There is no reason to prefer NewTimer when After will do.

Given that the currently supported versions of Go are 1.24 and 1.25, this linter is no longer needed.

As stated in the time package documentation, The issue highlighted by
the timeafter linter is no longer a concern with Go versions >= 1.23:

> Before Go 1.23, this documentation warned that the underlying Timer
> would not be recovered by the garbage collector until the timer fired,
> and that if efficiency was a concern, code should use NewTimer instead
> and call Timer.Stop if the timer is no longer needed. As of Go 1.23,
> the garbage collector can recover unreferenced, unstopped timers.
> There is no reason to prefer NewTimer when After will do.

Given that the currently supported versions of Go are 1.24 and 1.25,
this linter is no longer needed.

Signed-off-by: Robin Hahling <[email protected]>
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.

1 participant