From 60997f79d20740df9c800ff26a4c2efb99a90fc2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 09:58:17 +0100 Subject: [PATCH] ax(mining): replace prose comments with usage examples on BaseMiner methods GetPath, GetBinaryPath, and Stop had comments that restated what the signature already said. AX Principle 2: comments show HOW with real values, not WHAT the type signature already declares. Co-Authored-By: Charon --- pkg/mining/miner.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/mining/miner.go b/pkg/mining/miner.go index 082143d..bc66efb 100644 --- a/pkg/mining/miner.go +++ b/pkg/mining/miner.go @@ -123,8 +123,7 @@ func (b *BaseMiner) GetName() string { return b.Name } -// GetPath returns the base installation directory for the miner type. -// It uses the stable ExecutableName field to ensure the correct path. +// path := miner.GetPath() // e.g. "/home/user/.local/share/lethean-desktop/miners/xmrig" func (b *BaseMiner) GetPath() string { dataPath, err := xdg.DataFile(fmt.Sprintf("lethean-desktop/miners/%s", b.ExecutableName)) if err != nil { @@ -137,15 +136,14 @@ func (b *BaseMiner) GetPath() string { return dataPath } -// GetBinaryPath returns the full path to the miner's executable file. +// binary := miner.GetBinaryPath() // e.g. "/home/user/.local/share/lethean-desktop/miners/xmrig/xmrig" func (b *BaseMiner) GetBinaryPath() string { b.mu.RLock() defer b.mu.RUnlock() return b.MinerBinary } -// Stop terminates the miner process gracefully. -// It first tries SIGTERM to allow cleanup, then SIGKILL if needed. +// if err := miner.Stop(); err != nil { log.Warn("stop failed", ...) } func (b *BaseMiner) Stop() error { b.mu.Lock()