]> Cypherpunks repositories - gostls13.git/commitdiff
compress/lzw,compress/gzip,compress/flate,compress/zlib,compress/bzip2: go doc links
authorOlivier Mengué <olivier.mengue@gmail.com>
Wed, 5 Mar 2025 16:44:53 +0000 (17:44 +0100)
committerGopher Robot <gobot@golang.org>
Thu, 6 Mar 2025 16:21:08 +0000 (08:21 -0800)
Add godoc links to compress/* package doc.

Change-Id: I768ca250a39b0bb70eca35ac5b3b77ead73ca5f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/655057
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>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
src/compress/bzip2/bzip2.go
src/compress/flate/inflate.go
src/compress/gzip/gunzip.go
src/compress/gzip/gzip.go
src/compress/lzw/reader.go
src/compress/zlib/writer.go

index d41ff2c83b7a9501d678f09cc9daa85d7bf8a26a..06991fbb2283e298ab28415f66d90882a5f4013c 100644 (file)
@@ -40,7 +40,7 @@ type reader struct {
        repeats     uint     // the number of copies of lastByte to output.
 }
 
-// NewReader returns an io.Reader which decompresses bzip2 data from r.
+// NewReader returns an [io.Reader] which decompresses bzip2 data from r.
 // If r does not also implement [io.ByteReader],
 // the decompressor may read more data than necessary from r.
 func NewReader(r io.Reader) io.Reader {
index 3c04445dda1ec995201864848cfc3382b2ac139f..3f2172bb5832b852e5ae1640204cadaa43930e6c 100644 (file)
@@ -3,8 +3,8 @@
 // license that can be found in the LICENSE file.
 
 // Package flate implements the DEFLATE compressed data format, described in
-// RFC 1951.  The gzip and zlib packages implement access to DEFLATE-based file
-// formats.
+// RFC 1951.  The [compress/gzip] and [compress/zlib] packages implement access
+// to DEFLATE-based file formats.
 package flate
 
 import (
@@ -820,7 +820,7 @@ func NewReader(r io.Reader) io.ReadCloser {
 // 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.
+// to read data compressed by [NewWriterDict].
 //
 // The ReadCloser returned by NewReaderDict also implements [Resetter].
 func NewReaderDict(r io.Reader, dict []byte) io.ReadCloser {
index 6ca05526edc71941d362b3621be492671f42e941..f3142dbf33561cb1b90a1e212b32169d9e748d09 100644 (file)
@@ -86,9 +86,9 @@ type Reader struct {
 // If r does not also implement [io.ByteReader],
 // the decompressor may read more data than necessary from r.
 //
-// It is the caller's responsibility to call Close on the [Reader] when done.
+// It is the caller's responsibility to call [Reader.Close] when done.
 //
-// The [Reader.Header] fields will be valid in the [Reader] returned.
+// The Reader.[Header] fields will be valid in the [Reader] returned.
 func NewReader(r io.Reader) (*Reader, error) {
        z := new(Reader)
        if err := z.Reset(r); err != nil {
index 5f24444237cef1e2499080db2010f3d0926b9852..a7f9e3e4fe00ba61674ba3a44efd7ea4048be2eb 100644 (file)
@@ -13,8 +13,8 @@ import (
        "time"
 )
 
-// These constants are copied from the flate package, so that code that imports
-// "compress/gzip" does not also have to import "compress/flate".
+// These constants are copied from the [flate] package, so that code that imports
+// [compress/gzip] does not also have to import [compress/flate].
 const (
        NoCompression      = flate.NoCompression
        BestSpeed          = flate.BestSpeed
@@ -23,7 +23,7 @@ const (
        HuffmanOnly        = flate.HuffmanOnly
 )
 
-// A Writer is an io.WriteCloser.
+// A Writer is an [io.WriteCloser].
 // Writes to a Writer are compressed and written to w.
 type Writer struct {
        Header      // written at first call to Write, Flush, or Close
@@ -44,7 +44,7 @@ type Writer struct {
 // It is the caller's responsibility to call Close on the [Writer] when done.
 // Writes may be buffered and not flushed until Close.
 //
-// Callers that wish to set the fields in Writer.Header must do so before
+// Callers that wish to set the fields in Writer.[Header] must do so before
 // the first call to Write, Flush, or Close.
 func NewWriter(w io.Writer) *Writer {
        z, _ := NewWriterLevel(w, DefaultCompression)
index 2cdfaa11b223415b8e1509dc77b079b3fb579d0e..678e6253d06d8f559694ed4820d7cb37d155cb3b 100644 (file)
@@ -11,7 +11,7 @@
 // two non-literal codes are a clear code and an EOF code.
 //
 // The TIFF file format uses a similar but incompatible version of the LZW
-// algorithm. See the golang.org/x/image/tiff/lzw package for an
+// algorithm. See the [golang.org/x/image/tiff/lzw] package for an
 // implementation.
 package lzw
 
@@ -42,7 +42,7 @@ const (
        flushBuffer        = 1 << maxWidth
 )
 
-// Reader is an io.Reader which can be used to read compressed data in the
+// Reader is an [io.Reader] which can be used to read compressed data in the
 // LZW format.
 type Reader struct {
        r        io.ByteReader
index c65e80f742364ef81b94d8764dd38a0c64b9f162..93537268e03cba0808aaef1ef70a0a4d1e1acd39 100644 (file)
@@ -13,8 +13,8 @@ import (
        "io"
 )
 
-// These constants are copied from the flate package, so that code that imports
-// "compress/zlib" does not also have to import "compress/flate".
+// These constants are copied from the [flate] package, so that code that imports
+// [compress/zlib] does not also have to import [compress/flate].
 const (
        NoCompression      = flate.NoCompression
        BestSpeed          = flate.BestSpeed
@@ -24,7 +24,7 @@ const (
 )
 
 // A Writer takes data written to it and writes the compressed
-// form of that data to an underlying writer (see NewWriter).
+// form of that data to an underlying writer (see [NewWriter]).
 type Writer struct {
        w           io.Writer
        level       int
@@ -36,7 +36,7 @@ type Writer struct {
        wroteHeader bool
 }
 
-// NewWriter creates a new Writer.
+// NewWriter creates a new [Writer].
 // Writes to the returned Writer are compressed and written to w.
 //
 // It is the caller's responsibility to call Close on the Writer when done.
@@ -46,17 +46,17 @@ func NewWriter(w io.Writer) *Writer {
        return z
 }
 
-// NewWriterLevel is like NewWriter but specifies the compression level instead
-// of assuming DefaultCompression.
+// NewWriterLevel is like [NewWriter] but specifies the compression level instead
+// of assuming [DefaultCompression].
 //
-// The compression level can be DefaultCompression, NoCompression, HuffmanOnly
-// or any integer value between BestSpeed and BestCompression inclusive.
+// The compression level can be [DefaultCompression], [NoCompression], [HuffmanOnly]
+// or any integer value between [BestSpeed] and [BestCompression] inclusive.
 // The error returned will be nil if the level is valid.
 func NewWriterLevel(w io.Writer, level int) (*Writer, error) {
        return NewWriterLevelDict(w, level, nil)
 }
 
-// NewWriterLevelDict is like NewWriterLevel but specifies a dictionary to
+// NewWriterLevelDict is like [NewWriterLevel] but specifies a dictionary to
 // compress with.
 //
 // The dictionary may be nil. If not, its contents should not be modified until
@@ -72,8 +72,8 @@ func NewWriterLevelDict(w io.Writer, level int, dict []byte) (*Writer, error) {
        }, nil
 }
 
-// Reset clears the state of the Writer z such that it is equivalent to its
-// initial state from NewWriterLevel or NewWriterLevelDict, but instead writing
+// Reset clears the state of the [Writer] z such that it is equivalent to its
+// initial state from [NewWriterLevel] or [NewWriterLevelDict], but instead writing
 // to w.
 func (z *Writer) Reset(w io.Writer) {
        z.w = w
@@ -138,8 +138,8 @@ func (z *Writer) writeHeader() (err error) {
        return nil
 }
 
-// Write writes a compressed form of p to the underlying io.Writer. The
-// compressed bytes are not necessarily flushed until the Writer is closed or
+// Write writes a compressed form of p to the underlying [io.Writer]. The
+// compressed bytes are not necessarily flushed until the [Writer] is closed or
 // explicitly flushed.
 func (z *Writer) Write(p []byte) (n int, err error) {
        if !z.wroteHeader {
@@ -160,7 +160,7 @@ func (z *Writer) Write(p []byte) (n int, err error) {
        return
 }
 
-// Flush flushes the Writer to its underlying io.Writer.
+// Flush flushes the Writer to its underlying [io.Writer].
 func (z *Writer) Flush() error {
        if !z.wroteHeader {
                z.err = z.writeHeader()
@@ -173,7 +173,7 @@ func (z *Writer) Flush() error {
 }
 
 // Close closes the Writer, flushing any unwritten data to the underlying
-// io.Writer, but does not close the underlying io.Writer.
+// [io.Writer], but does not close the underlying io.Writer.
 func (z *Writer) Close() error {
        if !z.wroteHeader {
                z.err = z.writeHeader()