Run modernize. Deprecate Go 1.22 by klauspost · Pull Request #1095 · klauspost/compress (original) (raw)

📝 Walkthrough

Walkthrough

Bump CI and module Go versions; widespread syntactic modernizations replacing interface{} with any, consolidate boundary clamps to min/max helpers, and convert many counted for loops to range-over-integer forms across core packages and tests. No exported API signatures intended to change.

Changes

Cohort / File(s) Summary
CI & module toolchains.github/workflows/go.yml, .github/workflows/release.yml, go.mod, huff0/_generate/go.mod, s2/cmd/_s2sx/go.mod, zstd/_generate/go.mod, s2/_generate/go.mod Bump GitHub Actions Go matrix to include 1.25.x and update pinned workflow tool versions; update module go and toolchain directives and selected indirect tooling versions.
any / sync.Pool New updatesflate/stateless.go, dict/builder.go, gzhttp/compress.go, gzhttp/writer/gzkp/gzkp.go, gzhttp/writer/gzstd/stdlib.go, internal/lz4ref/block.go, s2/writer.go, zstd/blockdec.go, zstd/zip.go, internal/*, s2/* Replace interface{} return types or variadic params with any (including sync.Pool.New literals and internal debug helpers). Purely syntactic modernization.
**Clamp consolidations (min/max)**dict/builder.go, flate/deflate.go, flate/dict_decoder.go, flate/level5.go, s2/encode_all.go, s2/encode_best.go, s2/encode_better.go, zstd/decoder.go, zstd/framedec.go, zstd/seqdec.go, zstd/seqdec_amd64.go, zstd/enc_base.go, zstd/enc_best.go, zstd/enc_better.go, s2/encode_* Replace multi-step boundary clamps and conditional clamps with single min/max helper expressions to centralize bounds logic; semantics intended to be preserved.
Range-over-integer loop style changesflate/deflate.go, flate/huffman_bit_writer.go, flate/huffman_code.go, flate/inflate.go, fse/bitwriter.go, fse/compress.go, huff0/*, internal/snapref/decode.go, s2/reader.go, zstd/blockdec.go, zstd/snappy.go, zstd/fse_encoder.go, snappy/*, many test files (e.g., flate/*_test.go, gzhttp/*_test.go, s2/*_test.go, zstd/*_test.go, zip/*_test.go, gzip/*_test.go) Convert many counted for i := 0; i < N; i++ loops to range-over-integer forms (e.g., for range N). Mostly stylistic and preserve iteration counts, but some changes affect loop-variable capture or introduce invalid range uses that require attention.
zstd encoder internals & dict updateszstd/enc_fast.go, zstd/enc_dfast.go, zstd/enc_better.go, zstd/dict.go Consolidate clamp patterns to max(...), refactor table updates (including marking shards dirty), simplify debug helpers, and adjust internal bookkeeping in encoder/dictionary paths. Internal logic changes beyond purely syntactic edits.
Bit-writer flush adjustmentsfse/bitwriter.go, huff0/bitwriter.go, zstd/bitwriter.go Convert byte-flush loops to range-based forms; zstd/bitwriter also clears bitContainer after flushing.
gzhttp & related pools/testsgzhttp/compress.go, gzhttp/asserts_test.go, gzhttp/compress_test.go, gzhttp/writer/gzkp/gzkp.go, gzhttp/writer/gzstd/stdlib.go Simplify buffer sizing with max, use strings.CutPrefix for parsing q= values, update pools to any, modernize test helper signatures to any, minor assertion message tweak, and some subtest capture adjustments.
Tests: numeric-loop conversions & capture changesflate/*_test.go, gzip/*_test.go, huff0/*_test.go, s2/*_test.go, snappy/*_test.go, zip/*_test.go, zstd/*_test.go, zlib/writer_test.go, gzhttp/*_test.go, internal/xxhash/xxhash_test.go Numerous tests converted counted loops to range forms; several per-iteration rebinding lines removed (may affect subtest closure capture), and a few tests use fmt.Appendf for direct byte construction. Review tests for capture-related regressions and compile correctness.
Misc small refactors & safety cleanupsflate/dict_decoder.go, flate/huffman_bit_writer.go, flate/level5.go, flate/stateless.go, zstd/decoder_test.go, zip/*, gzip/* Small refactors: clamp expressions simplified, loop-form changes, minor message edits, and a few places where range-over-int usage may be invalid—check compile correctness.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Chat

There are 3 ways to chat with CodeRabbit:

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

CodeRabbit Configuration File (.coderabbit.yaml)

Status, Documentation and Community