twitch: error checking for http.NewRequest - twitch-go - twitch.tv web application in Go
HTML git clone git://git.codemadness.org/twitch-go
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 41ee1372d6bd39c4b158fe286bce4babffdb5a54
DIR parent fe8557b38fc872643319712271503d6ab69b0b07
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 25 Jul 2015 14:28:06 +0200
twitch: error checking for http.NewRequest
Diffstat:
M src/twitch/twitch.go | 3 +++
1 file changed, 3 insertions(+), 0 deletions(-)
---
DIR diff --git a/src/twitch/twitch.go b/src/twitch/twitch.go
@@ -103,6 +103,9 @@ func ReadAllUrl(url string) ([]byte, error) {
Timeout: time.Duration(10) * time.Second,
}
req, err := http.NewRequest("GET", url, nil)
+ if err != nil {
+ return nil, err
+ }
resp, err := client.Do(req)
if resp != nil {
defer resp.Body.Close()