Skip to content

Conversation

@oikarinen
Copy link

Summary

Replace github.com/golang/snappy with github.com/klauspost/compress/snappy throughout the codebase. This change updates all import statements, dependency declarations, and license notices to use the klauspost implementation of Snappy compression.

Background & Motivation

The original golang/snappy package has been archived and is no longer actively maintained. The klauspost/compress library provides a drop-in replacement with the same API that is:

  • Actively maintained - Regular updates and bug fixes
  • API compatible - No code changes required beyond import paths
  • Performance improvements - Generally faster than the original implementation
  • Part of a comprehensive compression library - We already use klauspost/compress for zstd compression

This change eliminates our dependency on an archived package and consolidates our compression dependencies under a single, well-maintained library.

Changes Made

Source Code

  • Updated imports in x/mongo/driver/compression.go
  • Updated imports in x/mongo/driver/compression_test.go
  • Updated imports in x/mongo/driver/testdata/compression.go

Dependencies

  • Removed github.com/golang/snappy v1.0.0 from go.mod
  • Updated all submodule go.mod files via go mod tidy
  • Fixed replace directive in internal/test/goleak/go.mod to properly reference v2 module path

Documentation

  • Removed github.com/golang/snappy license notice from THIRD-PARTY-NOTICES
  • Kept existing github.com/klauspost/compress/snappy license notice

Testing

  • All existing compression tests pass without modification
  • go build ./... succeeds across all packages
  • Compression functionality verified with snappy, zlib, and zstd compressors

@github-actions github-actions bot added dependencies Pull requests that update a dependency file review-priority-normal Medium Priority PR for Review: within 1 business day documentation Pull requests that update documentation or examples labels Nov 26, 2025
@oikarinen oikarinen marked this pull request as ready for review November 26, 2025 20:44
@oikarinen oikarinen requested a review from a team as a code owner November 26, 2025 20:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the archived github.com/golang/snappy package with the actively maintained github.com/klauspost/compress/snappy library. The change is a straightforward dependency migration that requires only import path updates, as both packages provide API-compatible implementations of Snappy compression.

Key Changes:

  • Updated all import statements from github.com/golang/snappy to github.com/klauspost/compress/snappy
  • Removed github.com/golang/snappy v1.0.0 from all go.mod files via go mod tidy
  • Fixed module path replace directive in internal/test/goleak/go.mod to use v2 path
  • Removed github.com/golang/snappy license notice from THIRD-PARTY-NOTICES

Reviewed changes

Copilot reviewed 12 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
x/mongo/driver/compression.go Updated snappy import to klauspost implementation
x/mongo/driver/compression_test.go Updated snappy import in test file
x/mongo/driver/testdata/compression.go Updated snappy import in test data file
go.mod Removed golang/snappy dependency from main module
internal/test/goleak/go.mod Fixed v2 module path in replace directive and removed golang/snappy indirect dependency
internal/cmd/benchmark/go.mod Removed golang/snappy indirect dependency
internal/cmd/compilecheck/go.mod Removed golang/snappy indirect dependency
internal/cmd/faas/awslambda/mongodb/go.mod Removed golang/snappy indirect dependency
examples/_logger/logrus/go.mod Removed golang/snappy indirect dependency
examples/_logger/zap/go.mod Removed golang/snappy indirect dependency
examples/_logger/zerolog/go.mod Removed golang/snappy indirect dependency
THIRD-PARTY-NOTICES Removed license notice for archived golang/snappy package

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Pull requests that update documentation or examples review-priority-normal Medium Priority PR for Review: within 1 business day

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant