ax(mining): replace copy builtin shadow with settingsCopy, comment as usage example
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

AX Principle 1 — predictable names over short names: variable `copy` shadows
the Go builtin and carries no semantic meaning. Renamed to `settingsCopy`.
AX Principle 2 — comments as usage examples: replaced prose description on
SettingsManager.Get with a concrete call showing how the return value is used.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 07:50:36 +01:00
parent 4a586f4dad
commit 79a48a3a18
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -150,14 +150,15 @@ func (sm *SettingsManager) Save() error {
return os.WriteFile(sm.settingsPath, data, 0600)
}
// Get returns a copy of the current settings
// settings := sm.Get()
// if settings.Theme == "dark" { ... }
func (sm *SettingsManager) Get() *AppSettings {
sm.mu.RLock()
defer sm.mu.RUnlock()
// Return a copy to prevent concurrent modification
copy := *sm.settings
return &copy
settingsCopy := *sm.settings
return &settingsCopy
}
// Update applies changes to settings and saves