From ae80737a41a548f7d4342a9e8b04f839e4680e8d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 08:45:14 +0100 Subject: [PATCH] ax(mining): replace prose comments with usage examples on LoadMinersConfig/SaveMinersConfig AX Principle 2: comments as usage examples. Both functions had prose descriptions that restated the signature ("loads the miners configuration from the file system"). Replace with concrete call-site examples that show how to use the return value. Co-Authored-By: Charon --- pkg/mining/config_manager.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/mining/config_manager.go b/pkg/mining/config_manager.go index f35e1a4..3104827 100644 --- a/pkg/mining/config_manager.go +++ b/pkg/mining/config_manager.go @@ -47,7 +47,9 @@ func getMinersConfigPath() (string, error) { return xdg.ConfigFile("lethean-desktop/miners/config.json") } -// LoadMinersConfig loads the miners configuration from the file system. +// cfg, err := LoadMinersConfig() +// if err != nil { return err } +// cfg.Database.Enabled = false func LoadMinersConfig() (*MinersConfig, error) { configMu.RLock() defer configMu.RUnlock() @@ -82,8 +84,8 @@ func LoadMinersConfig() (*MinersConfig, error) { return &configuration, nil } -// SaveMinersConfig saves the miners configuration to the file system. -// Uses atomic write pattern: write to temp file, then rename. +// cfg.Database.RetentionDays = 60 +// if err := SaveMinersConfig(cfg); err != nil { return err } func SaveMinersConfig(configuration *MinersConfig) error { configMu.Lock() defer configMu.Unlock()