From 58e970ed79807fd9d2a29e1dcd4e44fa867b5540 Mon Sep 17 00:00:00 2001 From: Drew Flower Date: Thu, 30 Aug 2018 14:16:45 -0600 Subject: [PATCH] fmt: add an example for Sprintln Change-Id: I0fcb5e626bf3d6891592c21b912c824743d7eaa0 Reviewed-on: https://go-review.googlesource.com/132280 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/fmt/example_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fmt/example_test.go b/src/fmt/example_test.go index 92d5cd519e5..1d2cc0d7574 100644 --- a/src/fmt/example_test.go +++ b/src/fmt/example_test.go @@ -40,6 +40,14 @@ func ExamplePrintln() { // 21 } +func ExampleSprintln() { + s := "Aug" + sl := fmt.Sprintln("Today is 30", s) + fmt.Printf("%q", sl) + // Output: + // "Today is 30 Aug\n" +} + func ExampleFprintln() { n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers") if err != nil {