-
Notifications
You must be signed in to change notification settings - Fork 2
Replace BadgerDB with JSON file for persistent storage #3
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Remove BadgerDB dependency from go.mod - Implement JSON-based storage for stats (loadFromJSON, syncToJSON) - Update main.go to use JSON file instead of BadgerDB - Update README to remove BadgerDB references and 64-bit requirement - Simplify code by removing unnecessary database complexity Co-authored-by: unknwon <2946214+unknwon@users.noreply.github.com>
Co-authored-by: unknwon <2946214+unknwon@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove BadgerDB and use JSON file for data storage
Replace BadgerDB with JSON file for persistent storage
Nov 23, 2025
Owner
|
- Update go.mod to use Go 1.25.0 - Add .github/workflows/go.yml for CI (lint and test jobs) - Add .golangci.yml for linter configuration - CI ensures Go code compiles on ubuntu and macos Co-authored-by: unknwon <2946214+unknwon@users.noreply.github.com>
Contributor
Author
Done in 24aa240:
The CI workflow ensures Go code compiles on both ubuntu-latest and macos-latest platforms, runs golangci-lint, and checks go mod tidiness. |
Updated minimum Go version and configuration details.
Owner
|
- Change config field from DBPath to StatsPath (toml: db_path -> stats_path) - Update all references in main.go to use StatsPath - Remove .github/workflows/lsif.yml workflow file - GitHub Actions in go.yml already use latest versions (v4, v5, v7) Co-authored-by: unknwon <2946214+unknwon@users.noreply.github.com>
Contributor
Author
Updated GitHub Actions to use the latest versions of checkout and setup-go actions. Removed macOS from the testing matrix.
Owner
|
Make the os.Signal channel buffered with capacity 1 to prevent missing signals, as recommended by Go's signal.Notify documentation and detected by the sigchanyzer linter. Co-authored-by: unknwon <2946214+unknwon@users.noreply.github.com>
Contributor
Author
Removed comment about initializing stats.
unknwon
approved these changes
Nov 23, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace BadgerDB with JSON file for persistent storage
Summary
Successfully replaced BadgerDB with a simple JSON file for persistent storage, addressing the issue that BadgerDB was overkill and caused unnecessary resource usage and code complexity.
Plan
Changes Made
stats.go: Replaced BadgerDB operations with JSON file operations
loadFromDB()→loadFromJSON(): Loads stats from JSON filesyncToDB()→syncToJSON(): Syncs stats to JSON filemain.go: Simplified database initialization
getDBWithStats()→getStatsFromJSON(): Loads stats from JSONDBPathtoStatsPath(toml:db_path→stats_path)go.mod: Updated Go version and removed BadgerDB dependency
go mod tidyto clean up unused dependenciesREADME.md: Updated documentation
db_pathtostats_path.github/workflows/go.yml: Added CI workflow
.github/workflows/lsif.yml: Removed LSIF workflow
.golangci.yml: Added linter configuration
Testing
Successfully tested:
stats_pathworks correctlyBenefits
stats_pathbetter describes the JSON file purposeOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.