-
Notifications
You must be signed in to change notification settings - Fork 349
Fix simple encoder src/dst swapped #1083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 Walkthrough""" WalkthroughThe changes reverse the argument order in the Changes
Sequence Diagram(s)sequenceDiagram
participant Test as TestEncodeTo
participant File as Test File
participant Zstd as zstd.EncodeTo/DecodeTo
Test->>File: Open and read file content
Test->>Zstd: EncodeTo(src, dst)
Zstd-->>Test: Compressed data
Test->>Zstd: DecodeTo(compressed, dst)
Zstd-->>Test: Decompressed data
Test->>Test: Compare decompressed to original
Assessment against linked issues
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (16)
✨ 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Fixes #1081 (unreleased)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
zstd/simple_go124.go(1 hunks)zstd/simple_go124_test.go(1 hunks)zstd/zstd_test.go(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: klauspost
PR: klauspost/compress#1014
File: s2/encode_amd64.go:38-45
Timestamp: 2024-10-04T06:29:01.060Z
Learning: In `s2/encode_amd64.go`, when handling temporary buffers, arrays are required instead of slices.
Learnt from: klauspost
PR: klauspost/compress#1014
File: s2/encode_amd64.go:38-45
Timestamp: 2024-10-16T10:14:26.389Z
Learning: In `s2/encode_amd64.go`, when handling temporary buffers, arrays are required instead of slices.
zstd/zstd_test.go (2)
Learnt from: klauspost
PR: klauspost/compress#1014
File: s2/encode_amd64.go:38-45
Timestamp: 2024-10-04T06:29:01.060Z
Learning: In `s2/encode_amd64.go`, when handling temporary buffers, arrays are required instead of slices.
Learnt from: klauspost
PR: klauspost/compress#1014
File: s2/encode_amd64.go:38-45
Timestamp: 2024-10-16T10:14:26.389Z
Learning: In `s2/encode_amd64.go`, when handling temporary buffers, arrays are required instead of slices.
zstd/simple_go124.go (2)
Learnt from: klauspost
PR: klauspost/compress#1014
File: s2/encode_amd64.go:38-45
Timestamp: 2024-10-04T06:29:01.060Z
Learning: In `s2/encode_amd64.go`, when handling temporary buffers, arrays are required instead of slices.
Learnt from: klauspost
PR: klauspost/compress#1014
File: s2/encode_amd64.go:38-45
Timestamp: 2024-10-16T10:14:26.389Z
Learning: In `s2/encode_amd64.go`, when handling temporary buffers, arrays are required instead of slices.
zstd/simple_go124_test.go (2)
Learnt from: klauspost
PR: klauspost/compress#1014
File: s2/encode_amd64.go:38-45
Timestamp: 2024-10-04T06:29:01.060Z
Learning: In `s2/encode_amd64.go`, when handling temporary buffers, arrays are required instead of slices.
Learnt from: klauspost
PR: klauspost/compress#1014
File: s2/encode_amd64.go:38-45
Timestamp: 2024-10-16T10:14:26.389Z
Learning: In `s2/encode_amd64.go`, when handling temporary buffers, arrays are required instead of slices.
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: build (1.24.x, ubuntu-latest)
- GitHub Check: build (1.24.x, windows-latest)
- GitHub Check: build (1.24.x, macos-latest)
- GitHub Check: build (1.22.x, ubuntu-latest)
- GitHub Check: build (1.22.x, macos-latest)
- GitHub Check: fuzz-zstd ("noasm,nounsafe")
- GitHub Check: fuzz-other ("noasm,nounsafe")
- GitHub Check: fuzz-zstd (nounsafe)
- GitHub Check: fuzz-other (nounsafe)
- GitHub Check: build-special
- GitHub Check: Analyze (go)
🔇 Additional comments (4)
zstd/simple_go124.go (1)
33-33: LGTM! Parameter order fix looks correct.The change from
enc.EncodeAll(dst, src)toenc.EncodeAll(src, dst)aligns with the consistent pattern used inDecodeTo(line 55) and follows typical compression API conventions where source comes before destination.zstd/zstd_test.go (1)
124-124: Good refactoring: improved code locality.Moving the
datavariable to local scope within the benchmark function improves code locality and reduces package-level scope pollution.zstd/simple_go124_test.go (2)
48-57: Excellent test coverage for the parameter fix.The round-trip test properly validates that the
EncodeTo/DecodeToparameter order fix works correctly by ensuring compressed data can be decompressed back to match the original input exactly.
18-60: Well-structured comprehensive test.The test design using real data from the ZIP archive provides robust validation of compression/decompression correctness, with proper error handling and short test mode support.
Fixes #1081 (unreleased)
Summary by CodeRabbit
Bug Fixes
Tests