From ae4a0cc08f4f62ac6863685444176272cec86bee Mon Sep 17 00:00:00 2001 From: kyleju Date: Mon, 26 Aug 2024 18:49:08 +0000 Subject: [PATCH 1/3] nolint on the intended use of int64 to int conversion --- api/query/cache/backfill/backfill.go | 1 + api/query/cache/index/index.go | 1 + 2 files changed, 2 insertions(+) diff --git a/api/query/cache/backfill/backfill.go b/api/query/cache/backfill/backfill.go index 94a1d61c70b..5314db3e220 100644 --- a/api/query/cache/backfill/backfill.go +++ b/api/query/cache/backfill/backfill.go @@ -117,6 +117,7 @@ func FillIndex( func startBackfillMonitor(store shared.Datastore, logger shared.Logger, maxBytes uint64, m *backfillMonitor) error { // FetchRuns will return at most N runs for each product, so divide the upper bound by the number of products. + //nolint:gosec limit := int(maxBytes/bytesPerRun) / len(shared.GetDefaultProducts()) runsByProduct, err := store.TestRunQuery().LoadTestRuns(shared.GetDefaultProducts(), nil, nil, nil, nil, &limit, nil) if err != nil { diff --git a/api/query/cache/index/index.go b/api/query/cache/index/index.go index 55ea122c159..c048c94a6e9 100644 --- a/api/query/cache/index/index.go +++ b/api/query/cache/index/index.go @@ -207,6 +207,7 @@ func (i *shardedWPTIndex) IngestRun(r shared.TestRun) error { return err } + //nolint:gosec shardIdx := int(t.testID % numShardsU64) dataForShard := shardData[shardIdx] re := ResultID(shared.TestStatusValueFromString(res.Status)) From 46349ddb8c94d69836a826505e98c60c90c4c59c Mon Sep 17 00:00:00 2001 From: kyleju Date: Mon, 26 Aug 2024 20:33:55 +0000 Subject: [PATCH 2/3] Upgrade golint version --- Makefile | 2 +- api/query/cache/backfill/backfill.go | 1 - api/query/cache/index/index.go | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 96bb7e45f70..1a1d5e48302 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ GO_FILES := $(shell find $(WPTD_PATH) -type f -name '*.go') GO_TEST_FILES := $(shell find $(WPTD_PATH) -type f -name '*_test.go') # Golangci version should be updated periodically. # See: https://golangci-lint.run/usage/install/#other-ci -GOLANGCI_LINT_VERSION := v1.52.2 +GOLANGCI_LINT_VERSION := v1.60.3 build: go_build diff --git a/api/query/cache/backfill/backfill.go b/api/query/cache/backfill/backfill.go index 5314db3e220..94a1d61c70b 100644 --- a/api/query/cache/backfill/backfill.go +++ b/api/query/cache/backfill/backfill.go @@ -117,7 +117,6 @@ func FillIndex( func startBackfillMonitor(store shared.Datastore, logger shared.Logger, maxBytes uint64, m *backfillMonitor) error { // FetchRuns will return at most N runs for each product, so divide the upper bound by the number of products. - //nolint:gosec limit := int(maxBytes/bytesPerRun) / len(shared.GetDefaultProducts()) runsByProduct, err := store.TestRunQuery().LoadTestRuns(shared.GetDefaultProducts(), nil, nil, nil, nil, &limit, nil) if err != nil { diff --git a/api/query/cache/index/index.go b/api/query/cache/index/index.go index c048c94a6e9..55ea122c159 100644 --- a/api/query/cache/index/index.go +++ b/api/query/cache/index/index.go @@ -207,7 +207,6 @@ func (i *shardedWPTIndex) IngestRun(r shared.TestRun) error { return err } - //nolint:gosec shardIdx := int(t.testID % numShardsU64) dataForShard := shardData[shardIdx] re := ResultID(shared.TestStatusValueFromString(res.Status)) From cf394008e675ed346450d7d183102ef1b54d6c2f Mon Sep 17 00:00:00 2001 From: kyleju Date: Mon, 26 Aug 2024 20:48:36 +0000 Subject: [PATCH 3/3] reenable onlint --- api/query/cache/backfill/backfill.go | 1 + api/query/cache/index/index.go | 1 + 2 files changed, 2 insertions(+) diff --git a/api/query/cache/backfill/backfill.go b/api/query/cache/backfill/backfill.go index 94a1d61c70b..5314db3e220 100644 --- a/api/query/cache/backfill/backfill.go +++ b/api/query/cache/backfill/backfill.go @@ -117,6 +117,7 @@ func FillIndex( func startBackfillMonitor(store shared.Datastore, logger shared.Logger, maxBytes uint64, m *backfillMonitor) error { // FetchRuns will return at most N runs for each product, so divide the upper bound by the number of products. + //nolint:gosec limit := int(maxBytes/bytesPerRun) / len(shared.GetDefaultProducts()) runsByProduct, err := store.TestRunQuery().LoadTestRuns(shared.GetDefaultProducts(), nil, nil, nil, nil, &limit, nil) if err != nil { diff --git a/api/query/cache/index/index.go b/api/query/cache/index/index.go index 55ea122c159..c048c94a6e9 100644 --- a/api/query/cache/index/index.go +++ b/api/query/cache/index/index.go @@ -207,6 +207,7 @@ func (i *shardedWPTIndex) IngestRun(r shared.TestRun) error { return err } + //nolint:gosec shardIdx := int(t.testID % numShardsU64) dataForShard := shardData[shardIdx] re := ResultID(shared.TestStatusValueFromString(res.Status))