1// Copyright 2018 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package httpresponse
6
7import (
8	"log"
9	"net/http"
10)
11
12func goodHTTPGet() {
13	res, err := http.Get("http://foo.com")
14	if err != nil {
15		log.Fatal(err)
16	}
17	defer res.Body.Close()
18}
19
20func badHTTPGet() {
21	res, err := http.Get("http://foo.com")
22	defer res.Body.Close() // ERROR "using res before checking for errors"
23	if err != nil {
24		log.Fatal(err)
25	}
26}
27