ax(mining): rename fn to modifier in UpdateMinersConfig
`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:
parent
d6f69faf6b
commit
8d89df10cc
1 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue