]> Cypherpunks repositories - gostls13.git/commitdiff
time: fix typo in Truncate example
authorKeith Rarick <kr@xph.us>
Thu, 12 Jul 2018 06:08:21 +0000 (23:08 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 12 Jul 2018 15:01:16 +0000 (15:01 +0000)
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>

src/time/example_test.go

index e64b0eced1cf3e35d54ac07dfee559c42f7bc2a4..494a41680253d2f031679ffca74c1112421959b1 100644 (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() {