From 6b22f2b60d9e02886357cbf1e4e4882adf071e48 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 10:11:37 +0100 Subject: [PATCH] ax(mining): replace prose comments with usage examples in miner_factory.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AX Principle 2 — comments must show usage, not restate the signature. MinerConstructor, MinerFactory, and NewMinerFactory had prose descriptions that added no information beyond what the type already states. Co-Authored-By: Charon --- pkg/mining/miner_factory.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/mining/miner_factory.go b/pkg/mining/miner_factory.go index 17c70c5..dee18d9 100644 --- a/pkg/mining/miner_factory.go +++ b/pkg/mining/miner_factory.go @@ -5,10 +5,11 @@ import ( "sync" ) -// MinerConstructor is a function that creates a new miner instance +// f.Register("custom", func() Miner { return NewCustomMiner() }) type MinerConstructor func() Miner -// MinerFactory handles miner instantiation and registration +// factory := NewMinerFactory() +// factory.Register("xmrig", func() Miner { return NewXMRigMiner() }) type MinerFactory struct { mu sync.RWMutex constructors map[string]MinerConstructor @@ -18,7 +19,8 @@ type MinerFactory struct { // globalFactory is the default factory instance var globalFactory = NewMinerFactory() -// NewMinerFactory creates a new MinerFactory with default miners registered +// factory := NewMinerFactory() +// factory.Register("xmrig", func() Miner { return NewXMRigMiner() }) func NewMinerFactory() *MinerFactory { f := &MinerFactory{ constructors: make(map[string]MinerConstructor),