From f46f3432a60edafdcd6ec9925550859167812cd6 Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Tue, 12 Aug 2014 09:27:39 +1000 Subject: [PATCH] compress/{gzip,zlib}: mention that Close flushes Our other CloseFlushers (archive/tar, compress/flate) do mention this. The original change was accidentally submitted to the release branch: https://golang.org/cl/117430043/ TBR=rsc R=r, rsc CC=golang-codereviews https://golang.org/cl/124130043 --- src/pkg/compress/gzip/gzip.go | 3 ++- src/pkg/compress/zlib/writer.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pkg/compress/gzip/gzip.go b/src/pkg/compress/gzip/gzip.go index 3a0bf54e1b..5131d128e4 100644 --- a/src/pkg/compress/gzip/gzip.go +++ b/src/pkg/compress/gzip/gzip.go @@ -245,7 +245,8 @@ func (z *Writer) Flush() error { return z.err } -// Close closes the Writer. It does not close the underlying io.Writer. +// Close closes the Writer, flushing any unwritten data to the underlying +// io.Writer, but does not close the underlying io.Writer. func (z *Writer) Close() error { if z.err != nil { return z.err diff --git a/src/pkg/compress/zlib/writer.go b/src/pkg/compress/zlib/writer.go index fac7e15a7e..3b4313a8be 100644 --- a/src/pkg/compress/zlib/writer.go +++ b/src/pkg/compress/zlib/writer.go @@ -174,7 +174,8 @@ func (z *Writer) Flush() error { return z.err } -// Calling Close does not close the wrapped io.Writer originally passed to NewWriter. +// Close closes the Writer, flushing any unwritten data to the underlying +// io.Writer, but does not close the underlying io.Writer. func (z *Writer) Close() error { if !z.wroteHeader { z.err = z.writeHeader() -- 2.48.1