Skip to content
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

time: clarify that Reset can be called after Stop in Ticker documentation #72968

Open
gazerro opened this issue Mar 20, 2025 · 2 comments
Open
Labels
Documentation Issues describing a change to documentation. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@gazerro
Copy link
Contributor

gazerro commented Mar 20, 2025

I noticed that the current documentation for time.Ticker doesn't clearly mention that you can call Reset even after stopping the ticker with Stop. The Reset method was added later, but when it was introduced, the documentation for Stop was not updated accordingly. The current documentation suggests that the main reason the channel is not closed is to prevent a concurrent goroutine reading from the channel from seeing an erroneous “tick.” However, after the introduction of Reset, the primary reason for keeping the channel open is actually to allow a subsequent reset.

It would be great to update the docs to explicitly state that Reset can be used on a ticker even after Stop has been called, and that the channel isn't closed for that reason.

@gopherbot gopherbot added the Documentation Issues describing a change to documentation. label Mar 20, 2025
@cherrymui
Copy link
Member

cc @rsc @ianlancetaylor

@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 20, 2025
@cherrymui cherrymui added this to the Backlog milestone Mar 20, 2025
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/659695 mentions this issue: time: mention Reset in Ticker.Stop doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues describing a change to documentation. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants