From 3bd5551c3040630dc316bd34ebce3a1fd0f286ba Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 22 Dec 2023 14:45:49 -0700 Subject: [PATCH] lint --- x/incentives/keeper/distribute.go | 5 ++++- x/incentives/keeper/iterator.go | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/x/incentives/keeper/distribute.go b/x/incentives/keeper/distribute.go index 0354e3719ee..cedcd17cd67 100644 --- a/x/incentives/keeper/distribute.go +++ b/x/incentives/keeper/distribute.go @@ -399,8 +399,11 @@ func (k Keeper) distributeSyntheticInternal( } sortedAndTrimmedQualifiedLocks := make([]*lockuptypes.PeriodLock, curIndex) + // This is not an issue because we directly + // use v.index and &v.locks. However, we must be careful not to + // take the address of &v. + // nolint: exportloopref for _, v := range qualifiedLocksMap { - v := v if v.index < 0 { continue } diff --git a/x/incentives/keeper/iterator.go b/x/incentives/keeper/iterator.go index aa1d5f636ec..649fca91c68 100644 --- a/x/incentives/keeper/iterator.go +++ b/x/incentives/keeper/iterator.go @@ -65,9 +65,9 @@ func (k Keeper) FinishedGaugesIterator(ctx sdk.Context) sdk.Iterator { // FilterLocksByMinDuration returns locks whose lock duration is greater than the provided minimum duration. func FilterLocksByMinDuration(locks []lockuptypes.PeriodLock, minDuration time.Duration) []*lockuptypes.PeriodLock { filteredLocks := make([]*lockuptypes.PeriodLock, 0, len(locks)) - for _, lock := range locks { - if lock.Duration >= minDuration { - filteredLocks = append(filteredLocks, &lock) + for i := range locks { + if locks[i].Duration >= minDuration { + filteredLocks = append(filteredLocks, &locks[i]) } } return filteredLocks