Multi-module Go monorepo. Each subdirectory is its own Go module.
| Module | Module path (go.mod) | Has Makefile | Tests |
|---|---|---|---|
| db/ | db |
yes | unit |
| cache/ | cache |
yes | unit (miniredis) |
| kafka/ | kafka |
yes | unit |
| rabbitmq/ | rabbitmq |
yes | unit |
| oauth2/ | oauth2 |
yes | unit (mock OIDC server) |
| i18n/ | i18n |
yes | unit (file-based) |
| cryptoutil/ | cryptoutil |
yes | unit (pure Go) |
| logger/ | logger |
yes | unit |
# Every module has a Makefile
cd db/ && make test
# -> go test -count=1 -timeout 120s ./...
# All modules from the repo root
make test
# Lint and vulnerability scan (one module, or all from the repo root)
cd db/ && make lint && make vuln
make lint
# Everything CI checks: tidy, vet, race tests, lint, vuln
make check- No test needs Docker.
- Never run
go testfrom the repo root (no rootgo.modorgo.work).
Each module follows: client.go (interfaces, sentinel errors, config) + named impl files.
- Constructors return interfaces, not concrete types.
db/interface hierarchy:DBTX(sqlc-compatible) →SQLExecutor(+ WithTransaction) →DB(+ Close, PingContext). Repositories receiveDBTXorSQLExecutor; only DI root getsDB.
See README.md. Boilerplate: go.mod (simple name), <name>.go (public API), impl.go, Makefile, <name>_test.go.
- No
go.workin the root (.gitignored). Modules are standalone. - Error classification via sentinel functions:
db.IsTimeoutError(err),db.IsDuplicateKeyError(err)— driver-agnostic, handles wrapped errors. db.ConnectionConfig.QueryTimeoutis applied to every query unless the caller's context has a tighter deadline..golangci.ymlat the repo root configures golangci-lint for every module (make lint);make vulnruns govulncheck.Makefile.commonholds the shared targets.- Go
1.27.2across all modules.