You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
( 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.
( 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.
The text was updated successfully, but these errors were encountered: