Skip to content

stopwatch: default Interval to 1s in New() to match the documented default#985

Open
c-tonneslan wants to merge 1 commit into
charmbracelet:masterfrom
c-tonneslan:fix/stopwatch-default-interval
Open

stopwatch: default Interval to 1s in New() to match the documented default#985
c-tonneslan wants to merge 1 commit into
charmbracelet:masterfrom
c-tonneslan:fix/stopwatch-default-interval

Conversation

@c-tonneslan
Copy link
Copy Markdown

Closes #862.

stopwatch.New() left Interval at the zero-value time.Duration, so calling Init() immediately and never ticking, even though both the field doc and the New comment say it defaults to 1 second. Initialise it in New so the documented default is what actually runs.

The doc on Model.Interval and the New() comment both say 1s, but the
zero-value time.Duration meant the ticker never advanced. Initialise
it in New so the documented default actually applies.

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
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