]> Cypherpunks repositories - gostls13.git/commitdiff
html/template: Add missing error check to package example.
authorDmitri Shuralyov <shurcooL@gmail.com>
Sun, 22 Nov 2015 01:09:08 +0000 (17:09 -0800)
committerAndrew Gerrand <adg@golang.org>
Sun, 22 Nov 2015 22:00:21 +0000 (22:00 +0000)
This appears to be an unintended omission. The check func is declared
just above, and the err value from template.Parse is captured rather
than discarded via blank identifier. All following calls that similarly
return err are checked, so it can't be that this example elides error
checking for brevity. Finally, if you look at Example_autoescaping,
it does check err from template.Parse and its code is very similar.

Change-Id: I076e1846302d5f2cdb1d027ed85ca0db85e33ace
Reviewed-on: https://go-review.googlesource.com/17170
Reviewed-by: Andrew Gerrand <adg@golang.org>
src/html/template/example_test.go

index 40fc3ba47b559ea82fb58d6ebcf72575dd437da4..3fc982054ef60e45570f51a42347873ed7162c90 100644 (file)
@@ -31,6 +31,7 @@ func Example() {
                }
        }
        t, err := template.New("webpage").Parse(tpl)
+       check(err)
 
        data := struct {
                Title string