From: Thanabodee Charoenpiriyakij Date: Wed, 5 Sep 2018 06:40:29 +0000 (+0700) Subject: fmt: add example for Fprint X-Git-Tag: go1.12beta1~1139 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9facf35592457f0cdd1a9da665fd946002123007;p=gostls13.git fmt: add example for Fprint Updates #27376 Change-Id: I0ceb672a9fcd7bbf491be1577d7f135ef35b2561 Reviewed-on: https://go-review.googlesource.com/133455 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/fmt/example_test.go b/src/fmt/example_test.go index 1479b761b6..6aeee03e43 100644 --- a/src/fmt/example_test.go +++ b/src/fmt/example_test.go @@ -68,6 +68,17 @@ func ExampleSprintln() { // "Today is 30 Aug\n" } +func ExampleFprint() { + n, err := fmt.Fprint(os.Stdout, "there", "are", 99, "gophers", "\n") + if err != nil { + panic(err) + } + fmt.Print(n) + // Output: + // thereare99gophers + // 18 +} + func ExampleFprintln() { n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers") if err != nil {