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

feat: Add git hooks to enforce universal binary builds and improve CPU metric calculation.

This commit is contained in:
Tw93
2025-12-22 16:30:22 +08:00
parent d2dc68da90
commit 87fdd26272
8 changed files with 127 additions and 9 deletions

View File

@@ -5,6 +5,9 @@
```bash
# Install development tools
brew install shfmt shellcheck bats-core
# Install git hooks (validates universal binaries)
./scripts/setup-hooks.sh
```
## Development
@@ -154,7 +157,24 @@ Format: `[MODULE_NAME] message` output to stderr.
- Format code with `gofmt -w ./cmd/...`
- 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`
**Building Universal Binaries:**
⚠️ **IMPORTANT**: Never use `go build` directly to create `bin/analyze-go` or `bin/status-go`!
Mole must support both Intel and Apple Silicon Macs. Always use the build scripts:
```bash
# Build universal binaries (x86_64 + arm64)
./scripts/build-analyze.sh
./scripts/build-status.sh
```
For local development/testing, you can use:
- `go run ./cmd/status` or `go run ./cmd/analyze` (quick iteration)
- `go build ./cmd/status` (creates single-arch binary for testing)
The pre-commit hook will prevent you from accidentally committing non-universal binaries.
**Guidelines:**