golang / golang/snappy

Incorrect comment on NewBufferedWriter?

Open
#71 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.6k
Forks
168
PR merge metrics
No merged PRs in 30d

Description

The comment (and docs) to `NewBufferedWriter` state that "Users must call Close to guarantee all data has been forwarded to the underlying io.Writer": https://github.com/golang/snappy/blob/674baa8c7fc30da5df3074a459494a7e6b427dff/encode.go#L132

However, in looking at the Flush/Close implementations, and their usages in [tests](https://github.com/golang/snappy/blob/3ff355f7bbcd12d666f5a3ad9aaa9ae5aff7a069/snappy_test.go#L766), it seems that users only need to call `Flush`, not `Close`, which would allow a caller to continue using the buffered writer.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the NewBufferedWriter comment in encode.go and compare its wording with the Flush and Close implementations. Review the related usage in snappy_test.go, then update the comment and associated documentation to match the supported usage. Confirm the existing buffered-writer tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.