diff options
author | Rodolfo Rodriguez <rodolfobgibson@gmail.com> | 2018-08-30 18:14:09 -0600 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2018-08-31 00:43:12 +0000 |
commit | eeb2a11eeac2174590cd281c5f48cbec1717e4e6 (patch) | |
tree | 56e9be73f5537dfdc4df01cf8c84341360611d3a /src/fmt | |
parent | 770e37d24915f481a8ee79d24121eae170a2214d (diff) | |
download | go-eeb2a11eeac2174590cd281c5f48cbec1717e4e6.tar.gz go-eeb2a11eeac2174590cd281c5f48cbec1717e4e6.zip |
fmt: add Println example
Change-Id: Ifd509c0c6a6ea41094b6ae1f4931414325b152fd
Reviewed-on: https://go-review.googlesource.com/132475
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/fmt')
-rw-r--r-- | src/fmt/example_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
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 { |