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 <charon@lethean.io>
This commit is contained in:
parent
50169f5a8e
commit
60997f79d2
1 changed files with 3 additions and 5 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue