diff --git a/examples/temporary-files-and-directories/temporary-files-and-directories.go b/examples/temporary-files-and-directories/temporary-files-and-directories.go index abed14e..c41d230 100644 --- a/examples/temporary-files-and-directories/temporary-files-and-directories.go +++ b/examples/temporary-files-and-directories/temporary-files-and-directories.go @@ -53,6 +53,7 @@ func main() { // `TempFile`'s, but it returns a directory *name* // rather than an open file. dname, err := ioutil.TempDir("", "sampledir") + check(err) fmt.Println("Temp dir name:", dname) defer os.RemoveAll(dname) diff --git a/examples/temporary-files-and-directories/temporary-files-and-directories.hash b/examples/temporary-files-and-directories/temporary-files-and-directories.hash index ebe1eeb..cf6faa7 100644 --- a/examples/temporary-files-and-directories/temporary-files-and-directories.hash +++ b/examples/temporary-files-and-directories/temporary-files-and-directories.hash @@ -1,2 +1,2 @@ -371689e72c46daa43eefbd9b9f4eaa3c490e7fd2 -yKWE4QTsYQr +cc4755e23cb4ba3c0e0ef5554ec9e9477372422a +nMpjCsALS6P 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 diff --git a/examples/writing-files/writing-files.hash b/examples/writing-files/writing-files.hash index 3d09d10..1513200 100644 --- a/examples/writing-files/writing-files.hash +++ b/examples/writing-files/writing-files.hash @@ -1,2 +1,2 @@ -d4f19bc0168674b17551bbf55bab7af989452d0e -8kx-qYUXBpA +314a0074840e22b328b6412130c17b9bea53c9c9 +fQ7sd4gXv0F diff --git a/public/temporary-files-and-directories b/public/temporary-files-and-directories index 346ae74..1110be0 100644 --- a/public/temporary-files-and-directories +++ b/public/temporary-files-and-directories @@ -45,7 +45,7 @@ time.

- +
package main
 
@@ -175,6 +175,7 @@ rather than an open file.

    dname, err := ioutil.TempDir("", "sampledir")
+    check(err)
     fmt.Println("Temp dir name:", dname)
 
@@ -241,7 +242,7 @@ prefixing them with our temporary directory.

diff --git a/public/writing-files b/public/writing-files index 6d0626c..751a9e8 100644 --- a/public/writing-files +++ b/public/writing-files @@ -42,7 +42,7 @@ ones we saw earlier for reading.

- +
package main
 
@@ -162,6 +162,7 @@ after opening a file.

    n3, err := f.WriteString("writes\n")
+    check(err)
     fmt.Printf("wrote %d bytes\n", n3)
 
@@ -191,6 +192,7 @@ 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)
 
@@ -287,7 +289,7 @@ we’ve just seen to the stdin and stdout streams. diff --git a/tools/generate.go b/tools/generate.go index 04d2e92..ad6af0f 100644 --- a/tools/generate.go +++ b/tools/generate.go @@ -153,11 +153,10 @@ func resetURLHashFile(codehash, code, sourcePath string) string { } payload := strings.NewReader(code) resp, err := http.Post("https://play.golang.org/share", "text/plain", payload) - if err != nil { - panic(err) - } + check(err) defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) + check(err) urlkey := string(body) data := fmt.Sprintf("%s\n%s\n", codehash, urlkey) ioutil.WriteFile(sourcePath, []byte(data), 0644)