Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/glacials/winter. a thoughtful static website generator for long-lasting content twos.dev/winter
Something went wrong. Try again.
Repository Guidelines #
Project Structure & Module Organization #
cmd/: Cobra-based CLI commands (build,serve,init,freeze,test, etc.).document/: Core build pipeline (config, parsing, templates, images, URIs).cliutils/: Small CLI helpers (printing, prompts).testdata/anddocument/testdata/: Input/fixture files for tests.main.go: Entrypoint wiring version info to the CLI..github/workflows/: CI runninggo testand a release build.
Build, Test, and Development Commands #
go test ./...: Run all unit tests. Add-racelocally for data race checks.go run . --help: Preview CLI usage; try commands likego run . build -s.go build -o w .: Compile the CLI locally.- Versioned build (matches CI):
go build -ldflags="-X 'main.version=$(git describe --tags --always)'" -o w .. - Hygiene:
go fmt ./...andgo vet ./...before sending PRs.
Coding Style & Naming Conventions #
- Go formatting is canonical: run
go fmtand keep imports tidy. - Prefer idiomatic, small packages and clear exported names (CamelCase); files use
snake_case.go. - Errors: wrap with context (
fmt.Errorf("doing X: %w", err)) and log viaslogwhere appropriate. - Keep CLI flags consistent with existing ones (
-v/--verbose,-q/--quiet).
Testing Guidelines #
- Use the standard
testingpackage; name files*_test.goand testsTestXxx. - Favor table-driven tests; place fixtures under
testdata/. - Ensure deterministic outputs (templates, image ops) and cover edge cases.
- Run
go test ./...(and-racelocally) before committing.
Commit & Pull Request Guidelines #
- Commits: imperative, concise subject (≤72 chars). Examples:
fix reloader nil channel,feat: add build summary. - Reference issues/PRs when applicable (
(#123)). Squash trivial fixups. - PRs: include a clear description, reproduction or motivation, test coverage for changes, and notes on docs updates (README/CLI help) if behavior changes.
Architecture Overview #
- CLI is composed in
cmd/root.go; core build logic lives indocument/(viaSubstructure.ExecuteAll). build -sservesdist/onlocalhost:8100with live reload.