Created
February 28, 2018 21:10
-
-
Save crgimenes/31a4cc55c63c9cb351a0935c7294436f to your computer and use it in GitHub Desktop.
function to close descriptor using defer without ignore error
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
func closer(body io.Closer) { | |
err := body.Close() | |
if err != nil { | |
log.Errorln(err) | |
} | |
} | |
// defer closer(fileDescriptor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment