Fix lint: rename predeclared 'new' param, remove impossible nil check

This commit is contained in:
Viktor Liu
2026-03-26 10:40:48 +01:00
parent feb128bb8b
commit d64fff9daf
2 changed files with 5 additions and 9 deletions

View File

@@ -432,12 +432,12 @@ func (am *DefaultAccountManager) UpdateAccountSettings(ctx context.Context, acco
return newSettings, nil
}
func ipv6SettingsChanged(old, new *types.Settings) bool {
if old.NetworkRangeV6 != new.NetworkRangeV6 {
func ipv6SettingsChanged(oldSettings, newSettings *types.Settings) bool {
if oldSettings.NetworkRangeV6 != newSettings.NetworkRangeV6 {
return true
}
oldGroups := slices.Clone(old.IPv6EnabledGroups)
newGroups := slices.Clone(new.IPv6EnabledGroups)
oldGroups := slices.Clone(oldSettings.IPv6EnabledGroups)
newGroups := slices.Clone(newSettings.IPv6EnabledGroups)
slices.Sort(oldGroups)
slices.Sort(newGroups)
return !slices.Equal(oldGroups, newGroups)

View File

@@ -892,12 +892,8 @@ func (am *DefaultAccountManager) AddPeer(ctx context.Context, accountID, setupKe
return nil, nil, nil, fmt.Errorf("failed to add peer to database: %w", err)
}
if err != nil {
return nil, nil, nil, fmt.Errorf("failed to add peer to database after %d attempts: %w", maxAttempts, err)
}
if newPeer == nil {
return nil, nil, nil, fmt.Errorf("new peer is nil")
return nil, nil, nil, fmt.Errorf("failed to add peer to database after %d attempts: %w", maxAttempts, err)
}
opEvent.TargetID = newPeer.ID