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