1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 11:31:46 +00:00

Reconstruct the structure of go

This commit is contained in:
Tw93
2025-12-01 19:26:03 +08:00
parent 4bd4ffc7be
commit 36a84e5211
20 changed files with 1441 additions and 1273 deletions

View File

@@ -50,11 +50,27 @@ Config: `.editorconfig` and `.shellcheckrc`
## Go Components
`mo status` and `mo analyze` use Go for the interactive dashboards.
`mo status` and `mo analyze` use Go with Bubble Tea for interactive dashboards.
**Code organization:**
- Each module split into focused files by responsibility
- `cmd/analyze/` - Disk analyzer with 7 files under 500 lines each
- `cmd/status/` - System monitor with metrics split into 11 domain files
**Development workflow:**
- Format code with `gofmt -w ./cmd/...`
- Run `go test ./cmd/...` before submitting Go changes (ensures packages compile)
- Build universal binaries locally via `./scripts/build-status.sh` and `./scripts/build-analyze.sh`
- Run `go vet ./cmd/...` to check for issues
- Build with `go build ./...` to verify all packages compile
- Build universal binaries via `./scripts/build-status.sh` and `./scripts/build-analyze.sh`
**Guidelines:**
- Keep files focused on single responsibility
- Extract constants instead of magic numbers
- Use context for timeout control on external commands
- Add comments explaining why, not what
## Pull Requests