mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
2.3 KiB
2.3 KiB
Repository Guidelines
Project Structure & Module Organization
main.go: Application entrypoint (HTTP server on:8000).internal/: Private app code (e.g.,server/,service/,repository/,driver/,config/,view/). Templ views live ininternal/viewand generate*_templ.go.pkg/: Reusable packages shared across app layers.cmd/: Optional binaries/entrypoints.assets/: Static assets and images.docs/: Project documentation.scripts/,tmp/: Dev tooling and build artifacts (Air usestmp/).
Build, Test, and Development Commands
make dev: Start dev container with live reload (Air) onhttp://localhost:8000.make run: Build and run the Docker image withPORTandDATABASE_URL.make test: Rungo test ./...inside the running dev container.make format: Runtempl generate,templ fmt, andgo fmt.make lint: Rungolangci-lint.- Local alternative:
air -c .air.toml,go test ./...,go run ..
Coding Style & Naming Conventions
- Go formatting: Use
go fmt(tabs, standard import ordering). CI helpers:make format. - Linting:
golangci-lint run ./...viamake lint(fix issues before PR). - Packages: lowercase, no underscores; files: lowercase with underscores; exported
identifiers:
PascalCase; unexported:camelCase. - Templ: keep
.templininternal/view; commit sources, not generated*_templ.go.
Testing Guidelines
- Framework: standard
testingwith table-driven tests. - Files:
*_test.go; functions:TestXxx, benchmarks:BenchmarkXxx. - Run:
make test(in container) orgo test ./...locally. - Aim for meaningful coverage on new/changed code; include error paths.
Commit & Pull Request Guidelines
- Messages: Prefer Conventional Commits (e.g.,
feat(parser): ...,fix(config): ...). Short, imperative first line; scope optional. - PRs: Provide clear description, link issues (e.g.,
#45), include screenshots for UI, and note breaking changes/migrations. - Keep diffs focused; run
make formatandmake lintbefore opening.
Security & Configuration Tips
- Environment: Use
.env/prod.env; never commit secrets. Example:DATABASE_URL="host=... user=... database=...". - Ports: default
8000; configure viaPORT. - Dependencies: use
go mod tidyandmake up-depswhen updating.