On Mon, Jun 21, 2021 at 4:23 PM Steven Penny <srp...@gmail.com> wrote: > > > You asked a question. People here are genuinely trying to help you by > > giving you their acquired knowledge of (collectively) over more than a > > couple of decades of Go programming. > > OK, so all all these decades of experience, why cant anyone produce a small > program to demonstrate the problem? Either they cant be bothered, or they dont > actually know how to create a program that would demonstrate a bad situation > that could arise from not closing gzip reader. > > I am not questioning anyones knowledge, I am just asking for a demonstration, > rather than "do it because we said so".
It's not clear to me what kind of demonstration you are looking for. Your original example showed an interaction between os.Open and os.Rename on Windows, and you showed closing the underlying file without closing the gzip.Reader. I agree that in that sense nothing bad will happen if you don't close the gzip.Reader. The only thing that gzip.Reader.Close does is report whether there some error occurred while reading the compressed data. Would you be satisfied with a program that demonstrates that gzip.Reader.Close can return a non-nil error? Ian -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVHYSTe5nK6OL%2B0HJzk3LMRt53st-BYO45%2BO6HJg%2B-oPw%40mail.gmail.com.