package svc import ( "context" "example.com/program/internal/config" "git.yuntuo.hk/k2safe/go-omni/lifecycle" "git.yuntuo.hk/k2safe/go-omni/logx" ) // ServiceContext is project-owned. Add dependencies without global variables. // Runtime owns registered resources; Logger is borrowed from the entry point. type ServiceContext struct { *lifecycle.Runtime Config config.Config Logger *logx.Logger } // Init runs before Run. Register resources immediately with OnClose. // Register paired OnStop/OnDrain hooks before exposing background work. // Use WorkContext for accepted work; Context is the early stop notification. // OnDrain returns nil only after processing and final cleanup have completed. // Complete all registrations here, before Run can race with shutdown. // The drain name "go-omni/project/run" is reserved for the generated entry. func (c *ServiceContext) Init(ctx context.Context) error { return nil }