Skip to content

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

Open
@gazerro

Description

@gazerro

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions