From: Radek Sohlich Date: Fri, 3 Nov 2017 19:36:12 +0000 (+0100) Subject: time: example in doc for time.AppendFormat func X-Git-Tag: go1.10beta1~383 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e49d074c3449736d283354957d7e5f55a465e67b;p=gostls13.git time: example in doc for time.AppendFormat func The simple example would contribute to better understanding what function does. Change-Id: I36a2952df8b0e1762ec0cd908a867c457f39366e Reviewed-on: https://go-review.googlesource.com/75970 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/time/example_test.go b/src/time/example_test.go index 1507f3f175..bab129db3c 100644 --- a/src/time/example_test.go +++ b/src/time/example_test.go @@ -569,3 +569,14 @@ func ExampleTime_Sub() { // Output: // difference = 12h0m0s } + +func ExampleTime_AppendFormat() { + t := time.Date(2017, time.November, 4, 11, 0, 0, 0, time.UTC) + text := []byte("Time: ") + + text = t.AppendFormat(text, time.Kitchen) + fmt.Println(string(text)) + + // Output: + // Time: 11:00AM +}