Skip to content

v2: Stopwatch doesn't default to 1 second as documented #862

@jm8

Description

@jm8

Describe the bug
In v2, creating a stopwatch with stopwatch.New() (and no stopwatch.WithInterval argument) creates a stopwatch with an interval of 0, which causes some problems as the elapsed time never increases.

Source Code

// New creates a new stopwatch with 1s interval.
func New(opts ...Option) Model {
m := Model{
id: nextID(),
}
for _, opt := range opts {
opt(&m)
}
return m
}

Expected behavior
According to the documentation, the interval should default to 1 second.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions