From 4aa22327c2ca755ed402f524afde2b7af601e115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Fri, 27 Nov 2026 07:18:09 +0100 Subject: [PATCH] fix(platform): document the methods of the gzip writer golangci-lint (revive) requires comments on exported methods. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- internal/platform/compress.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/platform/compress.go b/internal/platform/compress.go index 8493ef5..3dca27f 100644 --- a/internal/platform/compress.go +++ b/internal/platform/compress.go @@ -104,6 +104,7 @@ func (w *gzipWriter) decide() { w.gz.Reset(w.ResponseWriter) } +// Write compresses b if decide chose to, which it does at the first write. func (w *gzipWriter) Write(b []byte) (int, error) { if !w.decided { if w.Header().Get("Content-Type") == "" { @@ -117,10 +118,12 @@ func (w *gzipWriter) Write(b []byte) (int, error) { return w.gz.Write(b) } +// WriteString writes s like Write, so strings are compressed as well. func (w *gzipWriter) WriteString(s string) (int, error) { return w.Write([]byte(s)) } +// Flush sends what is compressed so far, for responses that stream. func (w *gzipWriter) Flush() { if w.gz != nil { _ = w.gz.Flush()