Last Updated: 2025-11-07
Quick start guide for developers contributing to Eos - A Go-based CLI for Ubuntu server administration.
# Clone repository
git clone https://github.com/CodeMonkeyCybersecurity/eos.git
cd eos
# Install git hooks (REQUIRED)
./scripts/install-git-hooks.shThis installs:
- Pre-commit hook: Fast validation (2-5 seconds)
- Commit-msg hook: Enforces Conventional Commits
- Pre-push hook: Comprehensive validation before pushing
# golangci-lint (P0 - REQUIRED by CLAUDE.md)
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# gitleaks (RECOMMENDED for secret scanning)
# macOS
brew install gitleaks
# Linux
wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.1/gitleaks_8.18.1_linux_x64.tar.gz
tar -xzf gitleaks_*.tar.gz
sudo mv gitleaks /usr/local/bin/
rm gitleaks_*
# Verify installations
golangci-lint version
gitleaks version# Build the project
go build -o /tmp/eos-build ./cmd/
# Run linter
golangci-lint run
# Run tests
go test -v ./pkg/...
# All passing? You're ready to develop! ✅1. Create feature branch
git checkout -b feat/your-feature
2. Make changes, commit frequently
git add .
git commit -m "feat(scope): description"
# Pre-commit hook validates (2-5 sec)
# Commit-msg hook validates format
3. Push to remote
git push origin feat/your-feature
# Pre-push hook validates (1-2 min)
4. Create pull request
# CI/CD runs full validation
We use Conventional Commits:
<type>(<scope>): <subject>
[optional body]
[optional footer]
Valid types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style (formatting, semicolons)refactor: Code refactoringperf: Performance improvementstest: Adding/updating testsbuild: Build system changesci: CI/CD changeschore: Other changes (release, tooling)revert: Revert previous commit
Optional scopes:
vault,consul,nomad,bionicgpt,wazuh,claude, etc.
Examples:
git commit -m "feat(vault): add automatic token rotation"
git commit -m "fix: resolve build errors in pkg/bionicgpt"
git commit -m "docs(claude): update shift-left strategy"
git commit -m "refactor(nomad)!: change job API (BREAKING)"Breaking changes: Add ! after type/scope
Your code goes through 4 defensive layers:
AI assistants must run before marking complete:
go build -o /tmp/eos-build ./cmd/
golangci-lint run
go test -v ./pkg/...Runs on git commit (2-5 seconds):
- ✅ Full project build
- ✅
go veton staged files - ✅
gofmton staged files - ✅
golangci-linton staged files - ✅
gitleakssecret scanning - ✅ Tests on affected packages
Bypass (not recommended): git commit --no-verify
Runs on git push (1-2 minutes):
- ✅ Full test suite with race detection
- ✅ Multi-platform builds (linux/amd64, linux/arm64)
- ✅ Coverage analysis (warns below 70%)
- ✅ Full repository linting
Bypass (not recommended): git push --no-verify
Runs on every PR and push to main:
- ✅ 16 GitHub Actions workflows
- ✅ Quality, testing, security workflows
- ✅ Cannot be bypassed
# Quick tests (pre-commit)
go test -short ./pkg/...
# Full test suite
go test -v ./pkg/...
# With race detection
go test -v -race ./pkg/...
# Specific package
go test -v ./pkg/vault/...
# With coverage
go test -cover -coverprofile=coverage.out ./pkg/...
go tool cover -html=coverage.out# golangci-lint (comprehensive - 60+ linters)
golangci-lint run
# On specific files
golangci-lint run pkg/vault/client.go
# With verbose output
golangci-lint run -v
# go vet (standard)
go vet ./...
# gofmt (formatting)
gofmt -l .
gofmt -w . # Fix formatting# Scan for secrets (gitleaks)
gitleaks detect --config=.gitleaks.toml
# Scan specific files
gitleaks protect --staged
# Scan entire repository
gitleaks detect --no-git# Development build
go build -o /tmp/eos ./cmd/
# Multi-platform builds
GOOS=linux GOARCH=amd64 go build -o eos-linux-amd64 ./cmd/
GOOS=linux GOARCH=arm64 go build -o eos-linux-arm64 ./cmd/CRITICAL RULE: Business logic in pkg/, orchestration ONLY in cmd/
// ✅ GOOD: cmd/create/vault.go (orchestration)
func runVaultCreate(rc *eos_io.RuntimeContext, cmd *cobra.Command) error {
config := parseFlags(cmd)
return vault.Create(rc, config) // Delegate to pkg/
}
// ❌ BAD: Business logic in cmd/
func runVaultCreate(rc *eos_io.RuntimeContext, cmd *cobra.Command) error {
// Don't put file operations, loops, complex logic here!
}NEVER use fmt.Println - Always use structured logging:
logger := otelzap.Ctx(rc.Ctx)
logger.Info("Operation complete", zap.String("service", "vault"))
logger.Warn("Deprecated feature", zap.String("feature", "old-api"))
logger.Error("Operation failed", zap.Error(err))// ✅ GOOD: Context + remediation
if err != nil {
return fmt.Errorf("failed to initialize Vault: %w\n"+
"Ensure Vault is running: systemctl status vault", err)
}
// ❌ BAD: Generic error
if err != nil {
return fmt.Errorf("error: %w", err)
}NEVER hardcode values:
// ❌ BAD
os.MkdirAll("/etc/vault.d", 0755)
// ✅ GOOD
os.MkdirAll(vault.VaultConfigDir, vault.VaultDirPerm)Define constants in:
pkg/[service]/constants.go(service-specific)pkg/shared/ports.go(port numbers)pkg/shared/paths.go(common paths)
Symptom: Hook takes >10 seconds
Solution: Hook only checks staged files. If slow:
- Check network connectivity (Go may download toolchain)
- Verify golangci-lint is installed locally
- Run
golangci-lint cache clean
Symptom: ✗ Commit message validation FAILED
Solution: Use Conventional Commits format:
# Wrong
git commit -m "updated vault client"
# Right
git commit -m "refactor(vault): update client API"Symptom: ✗ Potential secrets detected!
Solution:
- Remove the secret from staged files
- Use environment variables or Vault instead
- Update
.gitleaks.tomlif false positive
Symptom: Linter reports issues
Solution:
- Read the error message carefully
- Fix the issue (don't bypass)
- If false positive, add to
.golangci.ymlexclusions - Reference: https://golangci-lint.run/usage/linters/
- Project Patterns: See CLAUDE.md for detailed patterns
- Roadmap: See ROADMAP.md for planned features
- Conventional Commits: https://www.conventionalcommits.org/
- golangci-lint: https://golangci-lint.run/
- gitleaks: https://github.com/gitleaks/gitleaks
# Setup
./scripts/install-git-hooks.sh
# Development
go build -o /tmp/eos ./cmd/
go test -v ./pkg/...
golangci-lint run
# Pre-commit (automatic)
git commit -m "feat: description"
# Pre-push (automatic)
git push origin branch-name
# Bypass (not recommended)
git commit --no-verify
git push --no-verify- Check CLAUDE.md for development standards
- Review existing code patterns in
pkg/ - Ask in team chat or create GitHub issue
- Reference: https://docs.claude.com/en/docs/claude-code/
Philosophy: "Technology serves humans, not the other way around" - Code Monkey Cybersecurity
Cybersecurity. With humans.