It is a pretty common practice to do defer x.Close() with all kinds of resources, to ensure that they get closed even if there is an early return from the function for an error. (Though it is not a good idea when x is a file that is being written to, since it ignores any errors returned by Close.) But it is not obligatory.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
For more options, visit https://groups.google.com/d/optout.