From 8d89df10cc3b4e7cac2b5b3d30c6330416322bf3 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 08:14:35 +0100 Subject: [PATCH] ax(mining): rename fn to modifier in UpdateMinersConfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `fn` is a single-letter abbreviation — AX principle 1 requires predictable names over short names. `modifier` describes the parameter's role clearly. Comment updated to a usage example per principle 2. Co-Authored-By: Charon --- pkg/mining/config_manager.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/mining/config_manager.go b/pkg/mining/config_manager.go index 04605c2..f35e1a4 100644 --- a/pkg/mining/config_manager.go +++ b/pkg/mining/config_manager.go @@ -107,8 +107,8 @@ func SaveMinersConfig(configuration *MinersConfig) error { } // UpdateMinersConfig atomically loads, modifies, and saves the miners config. -// This prevents race conditions in read-modify-write operations. -func UpdateMinersConfig(fn func(*MinersConfig) error) error { +// UpdateMinersConfig(func(c *MinersConfig) error { c.Miners = append(c.Miners, entry); return nil }) +func UpdateMinersConfig(modifier func(*MinersConfig) error) error { configMu.Lock() defer configMu.Unlock() @@ -139,7 +139,7 @@ func UpdateMinersConfig(fn func(*MinersConfig) error) error { } // Apply the modification - if err := fn(&configuration); err != nil { + if err := modifier(&configuration); err != nil { return err }