ax(mining): rename fn to modifier in UpdateMinersConfig
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

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

View file

@ -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
}