From 3691cb9faff379239a1ec78acd2da7618f228263 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Tue, 7 Mar 2023 17:47:48 +0100 Subject: [PATCH] Update build * Update Go to 1.20 * Update golangci-lint. * Update CI orb. * Fix staticcheck issue in perf collector. Signed-off-by: Ben Kochie --- .circleci/config.yml | 4 ++-- .github/workflows/golangci-lint.yml | 8 ++++---- .promu-cgo.yml | 2 +- .promu.yml | 2 +- collector/perf_linux.go | 9 --------- go.mod | 2 +- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5c5893a0..71e7946c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,13 +1,13 @@ --- version: 2.1 orbs: - prometheus: prometheus/prometheus@0.16.0 + prometheus: prometheus/prometheus@0.17.1 executors: # Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml # should also be updated. golang: docker: - - image: cimg/go:1.19 + - image: cimg/go:1.20 arm: machine: image: ubuntu-2004:current diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 6034bcbf..100cf932 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -18,13 +18,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - name: install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.20.x - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' - name: Lint - uses: golangci/golangci-lint-action@v3.2.0 + uses: golangci/golangci-lint-action@v3.4.0 with: - version: v1.45.2 + version: v1.51.2 diff --git a/.promu-cgo.yml b/.promu-cgo.yml index 2bde1bf1..975c6e32 100644 --- a/.promu-cgo.yml +++ b/.promu-cgo.yml @@ -1,7 +1,7 @@ go: # Whenever the Go version is updated here, .circle/config.yml and # .promu.yml should also be updated. - version: 1.19 + version: 1.20 cgo: true repository: path: github.com/prometheus/node_exporter diff --git a/.promu.yml b/.promu.yml index 0c035102..f37f8502 100644 --- a/.promu.yml +++ b/.promu.yml @@ -1,7 +1,7 @@ go: # Whenever the Go version is updated here, .circle/config.yml and # .promu-cgo.yml should also be updated. - version: 1.19 + version: 1.20 repository: path: github.com/prometheus/node_exporter build: diff --git a/collector/perf_linux.go b/collector/perf_linux.go index e61821cc..8934371a 100644 --- a/collector/perf_linux.go +++ b/collector/perf_linux.go @@ -707,9 +707,6 @@ func (c *perfCollector) updateHardwareStats(ch chan<- prometheus.Metric) error { if err := (*profiler).Profile(hwProfile); err != nil { return err } - if hwProfile == nil { - continue - } cpuid := strconv.Itoa(c.hwProfilerCPUMap[profiler]) @@ -795,9 +792,6 @@ func (c *perfCollector) updateSoftwareStats(ch chan<- prometheus.Metric) error { if err := (*profiler).Profile(swProfile); err != nil { return err } - if swProfile == nil { - continue - } cpuid := strconv.Itoa(c.swProfilerCPUMap[profiler]) @@ -851,9 +845,6 @@ func (c *perfCollector) updateCacheStats(ch chan<- prometheus.Metric) error { if err := (*profiler).Profile(cacheProfile); err != nil { return err } - if cacheProfile == nil { - continue - } cpuid := strconv.Itoa(c.cacheProfilerCPUMap[profiler]) diff --git a/go.mod b/go.mod index 14fbb1e8..0e15d64b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/prometheus/node_exporter -go 1.18 +go 1.19 require ( github.com/alecthomas/kingpin/v2 v2.3.2-0.20230301032407-649b5a2df7c0