Development
Prerequisites
Section titled “Prerequisites”- Go 1.25+
- Make (optional, for convenience)
- golangci-lint v2+ (for linting)
Clone & Build
Section titled “Clone & Build”git clone https://github.com/nassiharel/klim.gitcd klimmake buildThe binary is output to bin/klim with version/commit/date injected via ldflags.
Commands
Section titled “Commands”| Command | Description |
|---|---|
make all | Lint + test + build (default target) |
make build | Build bin/klim with version ldflags |
make test | Run tests with race detector (go test -race -count=1 ./...) |
make lint | Run golangci-lint |
make cover | Generate HTML coverage report |
make marketplace-validate | Validate marketplace tool/pack YAML files |
make marketplace-assemble | Assemble individual files → marketplace.yaml |
Testing
Section titled “Testing”Tests use standard Go testing patterns:
- Table-driven tests for systematic coverage
httptest.NewServerfor HTTP endpoint testingt.TempDir()for filesystem tests- In-memory archives for testing extraction
atomic.PointerforpmAvailableFunctest hooks
# Run all testsmake test
# Run tests for a specific packagego test ./internal/catalog/...
# Run with verbose outputgo test -v ./internal/pkgmgr/...Integration Tests
Section titled “Integration Tests”An opt-in integration test suite live-checks every marketplace package ID against real package managers:
# Runs against whatever PMs are on your PATHgo test -tags=integration -timeout=40m ./internal/marketplace/livecheck/...This is also run weekly in CI across Linux/macOS/Windows runners.
Linting
Section titled “Linting”make lint# or directlygolangci-lint runCI enforces gofmt, go vet, and golangci-lint on every PR.
CI Workflows
Section titled “CI Workflows”| Workflow | Trigger | What it does |
|---|---|---|
ci.yml | push/PR | Lint, test (Linux/macOS/Windows matrix), govulncheck |
marketplace.yml | push/PR (marketplace/**) | Validate, assemble, publish catalog |
marketplace-livecheck.yml | Weekly/manual | Live-check package IDs across all PMs |
release.yml | v* tag | GoReleaser → release, Homebrew tap, deb/rpm, SBOM |
codeql.yml | push/weekly | Security analysis |
Project Structure
Section titled “Project Structure”See the Architecture page for the full module layout and data flow.