Production-ready pure-Go repository template featuring a native cmd/xtask validation suite, layered modular domain architecture, strict Git hygiene, 3-day dependency cooldown enforcement, and automated GitHub Actions pipelines.
- 100% Native Go Tooling: Powered by
go run ./cmd/xtaskand standard library checks with zero Node.js or external script dependencies. - Strict AST & Concurrency Safety Lock: Runs
go vet ./..., pure-Gogo/astguardrails (forbidding"unsafe",init(),panic(),fmt.Print*,os.Exit,log.Fatal*,interface{}, mutable globals, and boolean flag parameters), and-racetests;internal/core/core_test.golocks all policy rules against weakening. - Layered Modular Architecture: Reference domain module (
internal/modules/math/) separatingentity,dto,repository,service,controller, andmodulelayers with automated boundary tests. - Eight Standardized Validation Gates:
lint,typecheck,unit tests,integration and architecture tests,cooldown,hygiene,notices, andrelease. - Supply-Chain Hardening: 3-day dependency cooldown policy (
.github/dependabot.ymldefault-days: 3, noreplaceor@latestdirectives), CodeQL static analysis, and automated SBOM/dependency inventory artifacts. - Zero Formatter Drift: Automated formatters (
gofmt,prettier) are intentionally excluded from hooks and CI so diffs stay focused on logic.
.
├── .githooks/ # Versioned commit-msg, pre-commit, and pre-push hooks
├── .github/
│ ├── CODEOWNERS # Code ownership rules (CHANGE ME)
│ ├── dependabot.yml # gomod and GitHub Actions updates with 3-day cooldown
│ └── workflows/ # validate.yml, nightly-tag.yml, security.yml
├── cmd/xtask/ # Native Go automation CLI (go run ./cmd/xtask <cmd>)
├── internal/
│ ├── core/ # HTTP mux (/health, /greet, /math/add) and tests
│ └── modules/math/ # Layered domain module (entity, dto, repository, service, controller, module)
├── ARCHITECTURE.md # Modular architecture and dependency boundary guide
├── AGENTS.md # Autonomous agent operating rules
├── CONTRIBUTING.md # Contributor workflow and commit grammar
├── SECURITY.md # Supply-chain controls and vulnerability reporting
├── LICENSE # Apache-2.0 License (Copyright (c) 2026 CHANGE_ME)
└── ThirdPartyNotices.txt # Generated dependency notice inventory
Enable repository hooks and run the full 8-gate validation suite:
git config core.hooksPath .githooks
go run ./cmd/xtask validateOther xtask commands:
go run ./cmd/xtask notices # Regenerate ThirdPartyNotices.txt from go list
go run ./cmd/xtask release --check # Verify VERSION matches CHANGELOG.md| Gate | Implementation | Purpose |
|---|---|---|
lint |
go vet ./... + AST checks |
Static go/ast safety rules, doc comments, "unsafe" ban |
typecheck |
go build ./... |
Full package compilation check |
unit tests |
go test -race -run TestUnit ./internal/... |
Race-checked unit test execution |
integration and architecture tests |
go test -race -run 'TestIntegration|TestArchitecture' ./internal/... |
Endpoints, layer boundaries, policy lock |
cooldown |
cmd/xtask/main.go + .github/dependabot.yml |
3-day dependency cooldown enforcement |
hygiene |
cmd/xtask/hygiene.go |
Anti-leak, required docs, path checks |
notices |
cmd/xtask/notices.go |
License inventory parity |
release |
cmd/xtask/release.go |
SemVer and CHANGELOG.md consistency |
dev: Active integration branch protected against deletion. Every push updates the rollingdevtag,dev-<short_sha>tag, anddevpre-release snapshot.main: Protected release branch. Accepts rebase-only pull requests fromdevafter all status checks pass. Merging triggers automaticvX.Y.Ztagging, GitHub Release creation, anddevfast-forward sync.
When bootstrapping a new repository from this template, update the following placeholders:
README.md: Replace# Project Template (CHANGE ME)with your project title and description.LICENSEandNOTICE: ReplaceCopyright (c) 2026 CHANGE_MEwith your copyright holder..github/CODEOWNERS: Uncomment and set your GitHub handle or team (* @your-handle, CHANGE ME).- Go Module Path: Replace
module example.com/change-meingo.modand internal Go imports (CHANGE ME). - Git Identity: Configure
git config user.nameand a GitHub noreply address (<id>+<handle>@users.noreply.github.com) locally before committing.
Licensed under the Apache-2.0 License. Copyright (c) 2026 CHANGE_ME.