ax(mining): replace prose comments with usage examples in miner_factory.go
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 <charon@lethean.io>
This commit is contained in:
parent
3ba5080234
commit
6b22f2b60d
1 changed files with 5 additions and 3 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue