Internally close calls z.decompressor.Close() where decompressor is
typically obtained via flat.NewReader(r) which states

NewReader returns a new ReadCloser that can be used to read the
uncompressed version of r. If r does not also implement io.ByteReader, the
decompressor may read more data than necessary from r. It is the caller's
responsibility to call Close on the ReadCloser when finished reading.

The ReadCloser returned by NewReader also implements Resetter.

It's been some time now but I'm pretty sure I've seen gzip Reader fail
silently when the Close error wasn't correctly checked, so there is a good
reason why you should not only call Close but also confirm it returns nil.

On Mon, 21 Jun 2021 at 23:44, Steven Penny <srp...@gmail.com> wrote:

> >> - https://golang.org/pkg/compress/flate
> >>
> >> - https://golang.org/pkg/compress/lzw
> >> - https://golang.org/pkg/compress/zlib
> >
> > All of these do.
>
> whoops, yeah thats true. However my original point still stands. Three
> people
> have replied now:
>
> - Axel Wagner
> - Bruno Albuquerque
> - Dan Kortschak
>
> and none has been able to provide a simple program that demonstrate a
> problem
> that could arise from not closing gzip reader. So I am confident for now at
> least that its not needed.
>
> --
> 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/CAP8dQmsmqFqOu-iS9-e%3D3FZimG4nybdwM-d53JccaCuGoXJjRg%40mail.gmail.com
> .
>

-- 
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/CAHEMsqZ97VQQqnJo5d-VjY9-YWuJoSxMtMnvg%2Be4dGq%2BjCrPtg%40mail.gmail.com.

Reply via email to