From 8dc2499aa62f768c6395c9754b8cabc1ce25c494 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 11 Feb 2022 14:53:56 -0800 Subject: libgo: update to Go1.18beta2 gotools/ * Makefile.am (go_cmd_cgo_files): Add ast_go118.go (check-go-tool): Copy golang.org/x/tools directories. * Makefile.in: Regenerate. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695 --- libgo/go/bufio/example_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libgo/go/bufio/example_test.go') diff --git a/libgo/go/bufio/example_test.go b/libgo/go/bufio/example_test.go index 8885d40..a864d11 100644 --- a/libgo/go/bufio/example_test.go +++ b/libgo/go/bufio/example_test.go @@ -20,6 +20,18 @@ func ExampleWriter() { // Output: Hello, world! } +func ExampleWriter_AvailableBuffer() { + w := bufio.NewWriter(os.Stdout) + for _, i := range []int64{1, 2, 3, 4} { + b := w.AvailableBuffer() + b = strconv.AppendInt(b, i, 10) + b = append(b, ' ') + w.Write(b) + } + w.Flush() + // Output: 1 2 3 4 +} + // The simplest use of a Scanner, to read standard input as a set of lines. func ExampleScanner_lines() { scanner := bufio.NewScanner(os.Stdin) -- cgit v1.1