From 7311e83283c382d4c8f935c7de0d3a751c261633 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 9 Mar 2020 12:32:57 +0200 Subject: [PATCH] Add error check to writing file --- examples/writing-files/writing-files.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/writing-files/writing-files.go b/examples/writing-files/writing-files.go index 82275ce..ef8bd06 100644 --- a/examples/writing-files/writing-files.go +++ b/examples/writing-files/writing-files.go @@ -40,6 +40,7 @@ func main() { // A `WriteString` is also available. n3, err := f.WriteString("writes\n") + check(err) fmt.Printf("wrote %d bytes\n", n3) // Issue a `Sync` to flush writes to stable storage. @@ -49,6 +50,7 @@ func main() { // to the buffered readers we saw earlier. w := bufio.NewWriter(f) n4, err := w.WriteString("buffered\n") + check(err) fmt.Printf("wrote %d bytes\n", n4) // Use `Flush` to ensure all buffered operations have