ax(mining): replace prose comments with usage examples on BaseMiner methods
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

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 <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 09:58:17 +01:00
parent 50169f5a8e
commit 60997f79d2
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -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()