]> Cypherpunks repositories - gostls13.git/commitdiff
compress/flate,compress/lzw: fix incorrect godoc links
authorOlivier Mengué <olivier.mengue@gmail.com>
Thu, 6 Mar 2025 08:23:15 +0000 (09:23 +0100)
committerGopher Robot <gobot@golang.org>
Fri, 7 Mar 2025 19:33:01 +0000 (11:33 -0800)
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>

src/compress/flate/deflate.go
src/compress/flate/inflate.go
src/compress/gzip/gunzip.go
src/compress/lzw/reader.go

index aa8e08861525ddba116710daccded6a8c02c86e9..6697f3a7913cd50f59a7b7fe5edb09f6177ea490 100644 (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)
index 3f2172bb5832b852e5ae1640204cadaa43930e6c..4ed6aade149982eeb4480deaa3267a513fbf5483 100644 (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].
index f3142dbf33561cb1b90a1e212b32169d9e748d09..cfc48240159b31063ac5837fd076d827c7a414e5 100644 (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() }
index 678e6253d06d8f559694ed4820d7cb37d155cb3b..00f2d72792bef605e318808fb2a7cf56f3ed7eba 100644 (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 {