1
0
mirror of https://github.com/golang/go synced 2024-11-23 11:20:05 -07:00

time: fix typo in Truncate example

The existing example code uses variable name d, but
prints t in its output. It's needlessly confusing.

Change-Id: I67bef3c732e84d2d89819f96b4b62663630fd69e
Reviewed-on: https://go-review.googlesource.com/123516
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Keith Rarick 2018-07-11 23:08:21 -07:00 committed by Brad Fitzpatrick
parent a7bcb5390d
commit 33c7f88eaf

View File

@ -74,17 +74,17 @@ func ExampleDuration_Truncate() {
}
for _, t := range trunc {
fmt.Printf("t.Truncate(%6s) = %s\n", t, d.Truncate(t).String())
fmt.Printf("d.Truncate(%6s) = %s\n", t, d.Truncate(t).String())
}
// Output:
// t.Truncate( 1ns) = 1h15m30.918273645s
// t.Truncate( 1µs) = 1h15m30.918273s
// t.Truncate( 1ms) = 1h15m30.918s
// t.Truncate( 1s) = 1h15m30s
// t.Truncate( 2s) = 1h15m30s
// t.Truncate( 1m0s) = 1h15m0s
// t.Truncate( 10m0s) = 1h10m0s
// t.Truncate(1h0m0s) = 1h0m0s
// d.Truncate( 1ns) = 1h15m30.918273645s
// d.Truncate( 1µs) = 1h15m30.918273s
// d.Truncate( 1ms) = 1h15m30.918s
// d.Truncate( 1s) = 1h15m30s
// d.Truncate( 2s) = 1h15m30s
// d.Truncate( 1m0s) = 1h15m0s
// d.Truncate( 10m0s) = 1h10m0s
// d.Truncate(1h0m0s) = 1h0m0s
}
func ExampleParseDuration() {