ax(mining): replace prose comments with usage examples in container.go
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled

AX Principle 2 — comments as usage examples, not prose descriptions.
NewContainer, Start, and Shutdown had comments restating the signature
("creates a new container", "begins all background services", etc.).
Replaced with concrete call examples showing how to invoke each function.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 09:31:10 +01:00
parent 02e60c2ab5
commit fdc7064e09
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -63,7 +63,8 @@ type Container struct {
shutdownCh chan struct{}
}
// NewContainer creates a new service container with the given configuration.
// container := NewContainer(DefaultContainerConfig())
// container.Initialize(ctx)
func NewContainer(config ContainerConfig) *Container {
return &Container{
config: config,
@ -127,7 +128,7 @@ func (c *Container) Initialize(ctx context.Context) error {
return nil
}
// Start begins all background services.
// if err := container.Start(ctx); err != nil { return err }
func (c *Container) Start(ctx context.Context) error {
c.mu.RLock()
defer c.mu.RUnlock()
@ -152,7 +153,7 @@ func (c *Container) Start(ctx context.Context) error {
return nil
}
// Shutdown gracefully stops all services in reverse order.
// defer container.Shutdown(ctx) // safe to call multiple times
func (c *Container) Shutdown(ctx context.Context) error {
c.mu.Lock()
defer c.mu.Unlock()