From 79a48a3a18d65446a284ef0357f2ca30b3c91d7d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 07:50:36 +0100 Subject: [PATCH] ax(mining): replace copy builtin shadow with settingsCopy, comment as usage example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/mining/settings_manager.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/mining/settings_manager.go b/pkg/mining/settings_manager.go index bd96c78..9d32f33 100644 --- a/pkg/mining/settings_manager.go +++ b/pkg/mining/settings_manager.go @@ -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 © + settingsCopy := *sm.settings + return &settingsCopy } // Update applies changes to settings and saves