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() {
1212 Timeout : 2 * time .Second , // want "Magic number: 2, in <assign> detected"
1313 }
1414
15- res , err := c .Get ("http ://www.google.com" )
15+ res , err := c .Get ("https ://www.google.com" )
1616 if err != nil {
1717 log .Fatal (err )
1818 }
19+ defer res .Body .Close ()
1920 if res .StatusCode != 200 { // want "Magic number: 200, in <condition> detected"
2021 log .Println ("Something went wrong" )
2122 }
@@ -26,10 +27,11 @@ func UseNoMagicNumber() {
2627 Timeout : time .Second ,
2728 }
2829
29- res , err := c .Get ("http ://www.google.com" )
30+ res , err := c .Get ("https ://www.google.com" )
3031 if err != nil {
3132 log .Fatal (err )
3233 }
34+ defer res .Body .Close ()
3335 if res .StatusCode != http .StatusOK {
3436 log .Println ("Something went wrong" )
3537 }
You can’t perform that action at this time.
0 commit comments