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

Ambiguity in time.Duration manipulation #34787

mcandre opened this issue Oct 9, 2019 · 1 comment


Copy link

commented Oct 9, 2019

time.Duration currently requires non-constant, non-literal multiplication with factors, such as hours x 3, minutes x 10, to be performed with explicit casting of the factor with time.Duration(factor). However, this casting can result in surprising duration products, when the programmer forgets to include the unit multiplier.

Should we therefore allow implicit casting of non-duration factors, as well as deprecate casting real values without units to durations?


This comment has been minimized.

Copy link

commented Oct 9, 2019

What exactly are you proposing? A change to the language, a change to the time package, or something else? Please clarify with examples.

@mvdan mvdan added the WaitingForInfo label Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.