File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
pkg/golinters/mnd/testdata Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,11 @@ func UseMagicNumber() {
12
12
Timeout : 2 * time .Second , // want "Magic number: 2, in <assign> detected"
13
13
}
14
14
15
- res , err := c .Get ("http ://www.google.com" )
15
+ res , err := c .Get ("https ://www.google.com" )
16
16
if err != nil {
17
17
log .Fatal (err )
18
18
}
19
+ defer res .Body .Close ()
19
20
if res .StatusCode != 200 { // want "Magic number: 200, in <condition> detected"
20
21
log .Println ("Something went wrong" )
21
22
}
@@ -26,10 +27,11 @@ func UseNoMagicNumber() {
26
27
Timeout : time .Second ,
27
28
}
28
29
29
- res , err := c .Get ("http ://www.google.com" )
30
+ res , err := c .Get ("https ://www.google.com" )
30
31
if err != nil {
31
32
log .Fatal (err )
32
33
}
34
+ defer res .Body .Close ()
33
35
if res .StatusCode != http .StatusOK {
34
36
log .Println ("Something went wrong" )
35
37
}
You can’t perform that action at this time.
0 commit comments