Created
February 9, 2017 07:46
-
-
Save YanhaoYang/10be4551632680cee1c40fb441ea8abe to your computer and use it in GitHub Desktop.
Solution: error return value not checked (defer response.Body.Close())
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Closable wraps Close() method | |
type Closable interface { | |
Close() error | |
} | |
func closeIt(obj Closable) { | |
err := obj.Close() | |
if err != nil { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment