ax(mining): replace prose comments with usage examples on LoadMinersConfig/SaveMinersConfig
Some checks failed
Security Scan / security (push) Successful in 30s
Test / test (push) Has been cancelled

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 <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 08:45:14 +01:00
parent 4c355049e7
commit ae80737a41
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

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