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: ParseDuration example bug #65666

Closed
imirkin opened this issue Feb 11, 2024 · 1 comment
Closed

time: ParseDuration example bug #65666

imirkin opened this issue Feb 11, 2024 · 1 comment
Assignees
Labels
Documentation NeedsFix The path to resolution is known, but the work has not been done.

Comments

@imirkin
Copy link

imirkin commented Feb 11, 2024

Go version

go version go1.21.6 linux/amd64

Output of go env in your module/workspace:

N/A

What did you do?

Navigate to https://pkg.go.dev/time#ParseDuration and expand the "Example" sub-link.

What did you see happen?

In src/time/example_test.go::ExampleParseDuration, visible at the earlier mentioned link:

fmt.Printf("There are %6.2e seconds in %v.\n", micro2.Seconds(), micro)

What did you expect to see?

fmt.Printf("There are %6.2e seconds in %v.\n", micro2.Seconds(), micro2)

Note micro -> micro2 in case the change isn't immediately apparent. Or perhaps the idea was to have micro as both. The two values are effectively the same, so nbd, but ... seems like the docs should be consistent in that regard.

@robpike robpike self-assigned this Feb 12, 2024
@gopherbot
Copy link

Change https://go.dev/cl/563275 mentions this issue: time: fix typo in ExampleParseDuration

@seankhliao seankhliao added Documentation NeedsFix The path to resolution is known, but the work has not been done. labels Feb 12, 2024
ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
A typo without consequences, but confusing nonetheless. The last
line prints micro2 and then micro, instead of micro2 twice.
One-character fix.

Fixes golang#65666

Change-Id: I61d636382a2223d53eac58d6ddbcc7c15b4efc85
Reviewed-on: https://go-review.googlesource.com/c/go/+/563275
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants