FAQ
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.

Andy

--
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 golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMay 11, '16 at 12:27a
activeMay 11, '16 at 10:50a
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase