Update build

* Update Go to 1.20
* Update golangci-lint.
* Update CI orb.
* Fix staticcheck issue in perf collector.

Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
Ben Kochie 2023-03-07 17:47:48 +01:00
parent 2f20a9bb3c
commit 3691cb9faf
No known key found for this signature in database
GPG Key ID: C646B23C9E3245F1
6 changed files with 9 additions and 18 deletions

View File

@ -1,13 +1,13 @@
--- ---
version: 2.1 version: 2.1
orbs: orbs:
prometheus: prometheus/prometheus@0.16.0 prometheus: prometheus/prometheus@0.17.1
executors: executors:
# Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml # Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml
# should also be updated. # should also be updated.
golang: golang:
docker: docker:
- image: cimg/go:1.19 - image: cimg/go:1.20
arm: arm:
machine: machine:
image: ubuntu-2004:current image: ubuntu-2004:current

View File

@ -18,13 +18,13 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: install Go - name: install Go
uses: actions/setup-go@v2 uses: actions/setup-go@v3
with: with:
go-version: 1.18.x go-version: 1.20.x
- name: Install snmp_exporter/generator dependencies - name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter' if: github.repository == 'prometheus/snmp_exporter'
- name: Lint - name: Lint
uses: golangci/golangci-lint-action@v3.2.0 uses: golangci/golangci-lint-action@v3.4.0
with: with:
version: v1.45.2 version: v1.51.2

View File

@ -1,7 +1,7 @@
go: go:
# Whenever the Go version is updated here, .circle/config.yml and # Whenever the Go version is updated here, .circle/config.yml and
# .promu.yml should also be updated. # .promu.yml should also be updated.
version: 1.19 version: 1.20
cgo: true cgo: true
repository: repository:
path: github.com/prometheus/node_exporter path: github.com/prometheus/node_exporter

View File

@ -1,7 +1,7 @@
go: go:
# Whenever the Go version is updated here, .circle/config.yml and # Whenever the Go version is updated here, .circle/config.yml and
# .promu-cgo.yml should also be updated. # .promu-cgo.yml should also be updated.
version: 1.19 version: 1.20
repository: repository:
path: github.com/prometheus/node_exporter path: github.com/prometheus/node_exporter
build: build:

View File

@ -707,9 +707,6 @@ func (c *perfCollector) updateHardwareStats(ch chan<- prometheus.Metric) error {
if err := (*profiler).Profile(hwProfile); err != nil { if err := (*profiler).Profile(hwProfile); err != nil {
return err return err
} }
if hwProfile == nil {
continue
}
cpuid := strconv.Itoa(c.hwProfilerCPUMap[profiler]) 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 { if err := (*profiler).Profile(swProfile); err != nil {
return err return err
} }
if swProfile == nil {
continue
}
cpuid := strconv.Itoa(c.swProfilerCPUMap[profiler]) 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 { if err := (*profiler).Profile(cacheProfile); err != nil {
return err return err
} }
if cacheProfile == nil {
continue
}
cpuid := strconv.Itoa(c.cacheProfilerCPUMap[profiler]) cpuid := strconv.Itoa(c.cacheProfilerCPUMap[profiler])

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/prometheus/node_exporter module github.com/prometheus/node_exporter
go 1.18 go 1.19
require ( require (
github.com/alecthomas/kingpin/v2 v2.3.2-0.20230301032407-649b5a2df7c0 github.com/alecthomas/kingpin/v2 v2.3.2-0.20230301032407-649b5a2df7c0