Skip to content

chore: clean up repo for new tag #130

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

Closed
wants to merge 8 commits into from
Closed

chore: clean up repo for new tag #130

wants to merge 8 commits into from

Conversation

aljo242
Copy link
Contributor

@aljo242 aljo242 commented May 15, 2025

I need to make a new tag so that we can unwind some dependencies. This PR just does some bumps and overall lint cleanup

Summary by CodeRabbit

  • New Features
    • Added a new Makefile target for automated lint fixing and updated linting tools to their latest versions.
  • Bug Fixes
    • Improved error handling in test helpers by adding a runtime check for invalid input.
  • Chores
    • Updated Go version requirement to 1.23+ and upgraded multiple dependencies for improved compatibility and security.
    • Refined linting and formatting configuration for more precise code quality checks.
    • Removed Nix flake configuration and streamlined development environment setup.
  • Documentation
    • Updated README to reflect new Go version requirements.
    • Clarified and corrected code comments for better understanding.

Copy link
Contributor

coderabbitai bot commented May 15, 2025

Walkthrough

This set of changes updates code style, configuration, and tooling across the project. The Go version and dependencies are upgraded, linting and formatting configurations are overhauled, and the Nix flake is removed. Minor code and comment adjustments improve clarity and enforce stricter linting, with some function and type renaming for consistency.

Changes

File(s) Change Summary
.golangci.yml Major rewrite: sets version, enables explicit linters, adds exclusion rules, configures issue limits, and introduces formatter settings.
Makefile Updates golangci-lint to v2, streamlines lint install/fix targets, removes separate format target, and consolidates PHONY declarations.
go.mod Bumps Go version to 1.23, updates many direct and indirect dependencies, removes one indirect dependency, and keeps a pinned version for grocksdb.
flake.nix Deletes Nix flake configuration, removing all Nix-based dev environment setup.
README.md Updates minimum required Go version from 1.19+ to 1.23+.
db.go Renames type alias dbCreator to dbCreatorFn, updates related variables and parameters, changes Options.Get return type to any, and clarifies comments.
memdb.go Changes anonymous backend creator function to use unnamed parameters, ignoring inputs.
backend_test.go, common_test.go, test_helpers.go, prefixdb_test.go Removes or adds //nolint:gosec comments for random number generation in tests; adds panic check in int642Bytes for negative input.
prefixdb_iterator.go Adds // nolint:unparam comment on newPrefixIterator to clarify future error handling.
types.go Updates interface comments to refer to correct names (BatchI, IteratorI).

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Make as Makefile
    participant Lint as golangci-lint
    participant Go as Go Toolchain

    Dev->>Make: make lint
    Make->>Lint: Install golangci-lint v2 (if needed)
    Make->>Lint: Run golangci-lint with new config
    Lint->>Go: Use Go 1.23+ and updated dependencies
    Lint-->>Dev: Report issues or fix with --fix
Loading

Poem

Hopping through code with a linting broom,
Upgrading Go, dependencies bloom!
Flake is gone, the Makefile’s neat,
Comments and types now skip a beat.
With every hop, the project’s tight—
A rabbit’s joy: code clean and light!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 38785e9 and d4b6930.

⛔ Files ignored due to path filters (2)
  • flake.lock is excluded by !**/*.lock
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (13)
  • .golangci.yml (1 hunks)
  • Makefile (1 hunks)
  • README.md (1 hunks)
  • backend_test.go (2 hunks)
  • common_test.go (4 hunks)
  • db.go (2 hunks)
  • flake.nix (0 hunks)
  • go.mod (1 hunks)
  • memdb.go (1 hunks)
  • prefixdb_iterator.go (1 hunks)
  • prefixdb_test.go (1 hunks)
  • test_helpers.go (1 hunks)
  • types.go (2 hunks)
💤 Files with no reviewable changes (1)
  • flake.nix
🧰 Additional context used
🧬 Code Graph Analysis (2)
memdb.go (2)
db.go (2)
  • MemDBBackend (19-19)
  • Options (32-34)
types.go (1)
  • DB (23-77)
db.go (1)
types.go (1)
  • DB (23-77)
🔇 Additional comments (34)
types.go (2)

79-83: Approve documentation update for BatchI comment
The comment was updated to correctly reference BatchI instead of Batch, aligning documentation with the actual interface alias.


112-116: Approve documentation update for IteratorI comment
The comment now correctly references IteratorI instead of Iterator, ensuring consistency between comments and code.

prefixdb_iterator.go (1)

38-38: Appropriate nolint:unparam usage
The // nolint:unparam directive on newPrefixIterator is justified to reserve an error return for future changes. This aligns with the updated linting configuration.

.golangci.yml (7)

1-1: Bump to golangci-lint v2 format
Updating version: "2" is correct to match the Makefile upgrade to golangci-lint v2.1.6.


5-5: Explicitly set default to none
Setting default: none ensures only explicitly enabled linters run, reducing noise.


7-23: Enable curated linters
The enabled list (e.g., bodyclose, nolintlint, staticcheck, unparam, etc.) aligns with the new lint policy, striking a balance between thorough checks and manageable output.


24-27: Configure nolintlint settings
The nolintlint options (require-explanation: false, require-specific: true) correctly relax some constraints while maintaining specificity.


28-33: Add exclusions for generated files and paths
Excluding generated: lax and the third_party, builtin, and examples paths prevents spurious lint failures in non-dev code.


34-36: Increase issue thresholds
Raising max-issues-per-linter and max-same-issues to 10000 accommodates large outputs without failing the CI prematurely.


37-46: Enable gofumpt and formatter exclusions
Enabling gofumpt and excluding generated code and the same set of paths ensures consistent formatting without reformatting third-party or built code.

README.md (1)

15-15: Update minimum Go version
Bumping the documented minimum Go version to 1.23+ aligns with the module version in go.mod and the updated CI.

prefixdb_test.go (1)

125-125: Suppress gosec warning in test
The // nolint:gosec // test logic comment is appropriate here, as the security concern is not applicable in this controlled test context.

test_helpers.go (1)

19-19: Removed //nolint:gosec directive for rand.Int63() usage.

The security linter suppression for this random number generation has been removed as part of the broader linting cleanup. This is appropriate as this is test code where cryptographic security is not critical.

memdb.go (1)

17-17: Improved clarity by using unnamed parameters for unused arguments.

Replacing the named parameters with underscores (_) makes it explicit that these parameters are not used in the function implementation. This follows Go best practices for handling unused parameters and is consistent with similar changes in other files.

backend_test.go (2)

16-16: Using unnamed parameters for clarity.

Good improvement to use underscores (_) for unused parameters, making it clear that these values are not used in the function implementation. This follows Go best practices and improves code readability.


356-357: Removed //nolint:gosec directives for rand usage in tests.

The security linter suppressions have been removed from these random number generation calls, consistent with similar changes in other test files. This is appropriate for test code where cryptographic security is not critical.

Makefile (5)

13-13: Updated golangci-lint to v2.1.6.

Upgrading to the latest major version of golangci-lint will provide access to new linting features and improvements.


18-18: Updated import path for golangci-lint v2.

The installation command correctly includes the /v2/ path segment, which is required for Go modules with major version 2 or higher.


21-24: Streamlined lint target to depend on lint-install.

This change improves the Makefile by properly expressing the dependency relationship between the lint and lint-install targets, ensuring the linter is installed before running.


26-30: Added new lint-fix target to replace the previous format target.

This is a good modernization that leverages golangci-lint's --fix option to automatically fix issues, rather than having separate formatting and linting steps. The go mod verify check ensures module integrity is maintained.


31-31: Consolidated PHONY declarations.

Good housekeeping to consolidate the PHONY declarations for related targets, making the Makefile more maintainable.

common_test.go (5)

96-96: Security linter suppression removed from random number generation.

The code now passes the random number generator calls directly to the linter without suppression, which aligns with the PR's goal of cleaning up linting. This is appropriate since these are benchmark functions where cryptographic security isn't required.


125-125: Security linter suppression removed from random number generation.

Similar to the previous instance, the suppression was removed from this benchmark's random number generator call, maintaining consistency across the codebase.


139-139: Security linter suppression removed from random number generation.

The pattern of removing gosec suppressions continues here, creating a consistent approach to random number generation in test code.


169-172: Added defensive check for negative integers.

The function now panics when given negative integers, which is a good guard against invalid input since converting negative int64 values to uint64 would lead to unexpected results.


179-179: Added linter suppression for test code.

The gosec suppression is appropriate here since this is test code and the potential issue with converting uint64 to int64 (which could overflow) is understood and acceptable in this context.

db.go (5)

17-18: Comment formatting improved for backend types.

The comment formatting was adjusted for consistency across all backend type definitions.

Also applies to: 20-21


30-30: Renamed type from dbCreator to dbCreatorFn.

The function type was renamed to better indicate that it represents a function, following modern Go naming conventions.


33-33: Updated return type from interface{} to any.

The Options.Get method now uses Go's more modern 'any' type alias instead of 'interface{}'. This requires Go 1.18+, which is satisfied by the updated Go version in go.mod.


37-37: Updated map declaration to use renamed type.

This change properly references the renamed dbCreatorFn type, maintaining consistency across the codebase.


39-39: Updated function signature and added linter directive explanation.

The function now uses the renamed type, and the comment explains why the 'force' parameter is unused but still included - it might be used differently in the future.

go.mod (3)

3-3: Upgraded Go version from 1.19 to 1.23.0.

This is a significant version upgrade that enables the use of newer language features, but also requires all developers and CI systems to update to this version.

Make sure this version change is documented in the README or other project documentation to inform users and contributors.


6-6: Updated direct dependencies to newer versions.

Updating github.com/cockroachdb/pebble to v1.1.5 and github.com/spf13/cast to v1.8.0 brings in bug fixes, performance improvements, and potentially new features.

Also applies to: 9-9


16-42:

✅ Verification successful

Updated numerous indirect dependencies.

This comprehensive update of indirect dependencies helps resolve security vulnerabilities, compatibility issues, and improves overall performance and stability.

Verify these updates don't introduce breaking changes by running the test suite:


🏁 Script executed:

#!/bin/bash
# Check if tests pass with the updated dependencies
go test -v ./...

Length of output: 10873


Indirect dependency updates validated

All tests passed successfully after updating the indirect dependencies in go.mod, confirming there are no breaking changes or regressions. Great work!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@aljo242 aljo242 closed this May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant