From fdc7064e090c455adbc5452b13b3bf5ff71fc3b0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 09:31:10 +0100 Subject: [PATCH] ax(mining): replace prose comments with usage examples in container.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/mining/container.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/mining/container.go b/pkg/mining/container.go index 116e94e..4991156 100644 --- a/pkg/mining/container.go +++ b/pkg/mining/container.go @@ -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()