Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compress/gzip: Close() documentation is incomplete #20551

Closed
gtownsend opened this issue Jun 1, 2017 · 2 comments
Closed

compress/gzip: Close() documentation is incomplete #20551

gtownsend opened this issue Jun 1, 2017 · 2 comments

Comments

@gtownsend
Copy link

( Originally noted running Go 1.8.3 locally on MacOS Sierra 10.12.5.
Looking at current on-line documentation at golang.org/pkg/compress/gzip. )

The documentation of Close() method of gzip.Writer says that it flushes any unwritten data and implies that it does nothing more. That's not quite correct. Critically, it also writes a termination sequence to the output file. Without this, the corresponding Reader will return an "unexpected EOF" error.

I think that's a significant omission. From the documentation I concluded that Flush and Close were equivalent, and I initially chose the wrong one.

Sample test program:
https://play.golang.org/p/zPOjLCAttg

The same situation also exists in the very similar compress/zlib package.

@ianlancetaylor
Copy link
Contributor

CC @dsnet

@ianlancetaylor ianlancetaylor added this to the Go1.9Maybe milestone Jun 2, 2017
@gopherbot
Copy link

CL https://golang.org/cl/44572 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants