From eeb2a11eeac2174590cd281c5f48cbec1717e4e6 Mon Sep 17 00:00:00 2001 From: Rodolfo Rodriguez Date: Thu, 30 Aug 2018 18:14:09 -0600 Subject: [PATCH] fmt: add Println example Change-Id: Ifd509c0c6a6ea41094b6ae1f4931414325b152fd Reviewed-on: https://go-review.googlesource.com/132475 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/fmt/example_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/fmt/example_test.go b/src/fmt/example_test.go index a600ebcafb..92d5cd519e 100644 --- a/src/fmt/example_test.go +++ b/src/fmt/example_test.go @@ -29,6 +29,17 @@ func ExampleSprintf() { // 15 } +func ExamplePrintln() { + n, err := fmt.Println("there", "are", 99, "gophers") + if err != nil { + panic(err) + } + fmt.Print(n) + // Output: + // there are 99 gophers + // 21 +} + func ExampleFprintln() { n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers") if err != nil { -- 2.50.0