feat: release v0.28 generic Go project scaffolding and lifecycle entry

This commit is contained in:
2026-09-29 23:58:20 +08:00
parent f8e0dcc5a6
commit 0b6c0043b6
42 changed files with 2134 additions and 117 deletions

View File

@@ -0,0 +1,19 @@
package run
import (
"context"
"example.com/program/internal/svc"
)
// Run is project-owned. Return nil for normal completion, or an error to fail.
// The starter waits for shutdown; a one-shot program can simply return when done.
// Register background stop/drain hooks in svc.Init, not concurrently here.
// Accepted background work uses deps.WorkContext(), not the early-stop ctx.
func Run(ctx context.Context, deps *svc.ServiceContext) error {
if deps.Config.Once {
deps.Logger.InfoContext(ctx, "program.completed")
return nil
}
<-ctx.Done()
return nil
}