refactor: reorganize codebase into packages - no functional changes#138
refactor: reorganize codebase into packages - no functional changes#138ravisastryk wants to merge 5 commits intoahrtr:mainfrom
Conversation
|
Overall, I think this is a little over-engineering for a repo with only 2.2k line of source code. That said, I don't mind refactoring it. If you have bandwidth, please do it step by step (break down this PR into multiple smaller PRs, one PR for each step) so that it's easier to review. Thanks for the effort anyway. |
Thanks for the feedback @ahrtr! I will split into these smaller PRs(probably will stack them):
I will keep this PR open and rebase it after PRs 1-3 merge, so it becomes the final piece. Will open PRs shortly. |
- Move version.go → pkg/version/version.go (public API) - Move config.go → internal/config/config.go Part of codebase reorganization (Issue ahrtr#137). No functional changes. PR 1 of 4 in the stacked refactoring series.
f4d0225 to
a5b766a
Compare
- Move rule evaluation logic to internal/eval - Move endpoint resolution and filtering to internal/endpoint - Relocate associated tests to new package locations Part of codebase reorganization (Issue ahrtr#137). No functional changes. PR 2 of 4 in the stacked refactoring series.
- Move disalarm.go → internal/alarm/disalarm.go - Create internal/client/client.go for etcd client wrapper Part of codebase reorganization (Issue ahrtr#137). No functional changes. PR 3 of 4 in the stacked refactoring series.
a5b766a to
ad0c820
Compare
Summary
Restructure the etcd-defrag codebase from a flat file layout in the root directory into an organized Go package structure.
This is a pure refactoring with zero functional changes - all CLI flags, behavior, and output remain exactly the same.
Issue: #137
Why This Change Is Needed
Problems with Current Flat Structure
The current codebase has all Go files in the root directory:
Issues:
mainpackageBenefits of Package Structure
internal/packages are implementation details;pkg/is public APIArchitecture Changes
Before: Flat Structure
After: Package Structure
Testing