diff --git a/app/monitoringapi.go b/app/monitoringapi.go index 4ca196e42..3e6994d48 100644 --- a/app/monitoringapi.go +++ b/app/monitoringapi.go @@ -284,7 +284,7 @@ func quorumPeersConnected(peerIDs []peer.ID, tcpNode host.Host) bool { func stackComponents(names []string, cliParams []string) { validatorStackParamsGauge.Reset() - for i := 0; i < len(names); i++ { + for i := range len(names) { validatorStackParamsGauge.WithLabelValues(names[i], cliParams[i]).Set(1) } } diff --git a/app/stacksnipe/stacksnipe_test.go b/app/stacksnipe/stacksnipe_test.go index e45589271..98111ec68 100644 --- a/app/stacksnipe/stacksnipe_test.go +++ b/app/stacksnipe/stacksnipe_test.go @@ -56,7 +56,7 @@ func Test_StackSnipe(t *testing.T) { "run_1", } - for idx := 0; idx < len(names); idx++ { + for idx := range len(names) { populateProc(t, baseDir, procEntry{ pid: uint64(42 + idx), procName: names[idx], @@ -64,7 +64,7 @@ func Test_StackSnipe(t *testing.T) { }) } - for idx := 0; idx < len(extraNames); idx++ { + for idx := range len(extraNames) { populateProc(t, baseDir, procEntry{ pid: uint64(52 + idx), procName: extraNames[idx], @@ -98,7 +98,7 @@ func Test_StackSnipe(t *testing.T) { require.ElementsMatch(t, result.names, namesExpected) require.ElementsMatch(t, result.cmdlines, cmdlines) - for idx := 0; idx < len(extraNames); idx++ { + for idx := range len(extraNames) { require.NotContains(t, result.names, extraNames[idx]) require.NotContains(t, result.cmdlines, extraCmdlines[idx]) }