compress/flate,compress/lzw: fix incorrect godoc links

Fix incorrect godoc links related to the use of the name "Reader" for
different things in the various compress/* packages:
- in compress/flate Reader is the interface describing the underlying reader,
  not the decompressor as in other packages, so "returned reader" must
  not be linked to Reader.
- in compress/lzw and compress/gzip Reader is the decompressor, not the
  interface of the underlying reader, so "underlying reader" must not
  be linked to Reader.

With this patch the formatting of "underlying reader" and "returned
reader" is consistent accross compress/* packages.

Change-Id: Iea315fd5ee5b6c177855693d68841f3709a382cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/655335
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Olivier Mengué 2025-03-06 09:23:15 +01:00 committed by Gopher Robot
parent b4a333fea5
commit d7e5cd5851
4 changed files with 7 additions and 7 deletions

View file

@ -671,8 +671,8 @@ func NewWriter(w io.Writer, level int) (*Writer, error) {
// [Writer] with a preset dictionary. The returned [Writer] behaves
// as if the dictionary had been written to it without producing
// any compressed output. The compressed data written to w
// can only be decompressed by a [Reader] initialized with the
// same dictionary.
// can only be decompressed by a reader initialized with the
// same dictionary (see [NewReaderDict]).
func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, error) {
dw := &dictWriter{w}
zw, err := NewWriter(dw, level)

View file

@ -256,7 +256,7 @@ func (h *huffmanDecoder) init(lengths []int) bool {
}
// The actual read interface needed by [NewReader].
// If the passed in io.Reader does not also have ReadByte,
// If the passed in [io.Reader] does not also have ReadByte,
// the [NewReader] will introduce its own buffering.
type Reader interface {
io.Reader
@ -817,7 +817,7 @@ func NewReader(r io.Reader) io.ReadCloser {
}
// NewReaderDict is like [NewReader] but initializes the reader
// with a preset dictionary. The returned [Reader] behaves as if
// with a preset dictionary. The returned reader behaves as if
// the uncompressed data stream started with the given dictionary,
// which has already been read. NewReaderDict is typically used
// to read data compressed by [NewWriterDict].

View file

@ -242,7 +242,7 @@ func (z *Reader) readHeader() (hdr Header, err error) {
return hdr, nil
}
// Read implements [io.Reader], reading uncompressed bytes from its underlying [Reader].
// Read implements [io.Reader], reading uncompressed bytes from its underlying reader.
func (z *Reader) Read(p []byte) (n int, err error) {
if z.err != nil {
return 0, z.err
@ -284,7 +284,7 @@ func (z *Reader) Read(p []byte) (n int, err error) {
return n, nil
}
// Close closes the [Reader]. It does not close the underlying [io.Reader].
// Close closes the [Reader]. It does not close the underlying reader.
// In order for the GZIP checksum to be verified, the reader must be
// fully consumed until the [io.EOF].
func (z *Reader) Close() error { return z.decompressor.Close() }

View file

@ -118,7 +118,7 @@ func (r *Reader) readMSB() (uint16, error) {
return code, nil
}
// Read implements io.Reader, reading uncompressed bytes from its underlying [Reader].
// Read implements io.Reader, reading uncompressed bytes from its underlying reader.
func (r *Reader) Read(b []byte) (int, error) {
for {
if len(r.toRead) > 0 {