Skip to content

Instantly share code, notes, and snippets.

@crgimenes
Created February 28, 2018 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crgimenes/31a4cc55c63c9cb351a0935c7294436f to your computer and use it in GitHub Desktop.
Save crgimenes/31a4cc55c63c9cb351a0935c7294436f to your computer and use it in GitHub Desktop.
function to close descriptor using defer without ignore error
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