From c148e0c32631311346ae12be3fc310a6ecd84b2a Mon Sep 17 00:00:00 2001 From: Igor Peshansky Date: Wed, 11 Sep 2024 17:17:33 -0400 Subject: [PATCH] Fix lint errors. --- .golangci.yaml | 1 + receiver/dcgmreceiver/client.go | 6 +++--- receiver/dcgmreceiver/scraper.go | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 349cc25c1..3c6fe5109 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -57,6 +57,7 @@ linters-settings: - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf disable: - fieldalignment + - shadow enable-all: true misspell: locale: US diff --git a/receiver/dcgmreceiver/client.go b/receiver/dcgmreceiver/client.go index 85b01915f..afed5427e 100644 --- a/receiver/dcgmreceiver/client.go +++ b/receiver/dcgmreceiver/client.go @@ -358,13 +358,13 @@ func (client *dcgmClient) collect() (time.Duration, error) { func (client *dcgmClient) getDeviceMetrics() map[uint]deviceMetrics { out := map[uint]deviceMetrics{} for gpuIndex, device := range client.devices { - new := MetricsMap{} + newMetrics := MetricsMap{} for key, value := range device.Metrics { newValue := *value - new[key] = &newValue + newMetrics[key] = &newValue } // device is already a copy here - device.Metrics = new + device.Metrics = newMetrics out[gpuIndex] = device } return out diff --git a/receiver/dcgmreceiver/scraper.go b/receiver/dcgmreceiver/scraper.go index 79f47b5f7..990bdf48c 100644 --- a/receiver/dcgmreceiver/scraper.go +++ b/receiver/dcgmreceiver/scraper.go @@ -84,7 +84,7 @@ func (s *dcgmScraper) start(ctx context.Context, _ component.Host) error { s.cancel = func() { scrapeCancel() - g.Wait() + _ = g.Wait() // Ignore the error from a cancelled context } metricsCh := make(chan map[uint]deviceMetrics) @@ -196,7 +196,6 @@ func (s *dcgmScraper) runConnectLoop(ctx context.Context, metricsCh chan<- map[u case <-time.After(s.initRetryDelay): } } - return nil } func (s *dcgmScraper) pollClient(ctx context.Context, client *dcgmClient, metricsCh chan<- map[uint]deviceMetrics, collectTriggerCh <-chan struct{}) {