Skip to content

Commit c6dabdf

Browse files
committed
chore: bump deps, modernize .goreleaser.yml
Signed-off-by: Utku Ozdemir <utkuozdemir@gmail.com>
1 parent 6fceb18 commit c6dabdf

9 files changed

Lines changed: 192 additions & 129 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
uses: golangci/golangci-lint-action@v9.0.0
4545
with:
4646
# renovate: depName=golangci/golangci-lint datasource=github-releases
47-
version: v2.5.0
47+
version: v2.11.1
4848
args: --timeout=3m0s
4949
- name: Run tests
5050
run: go test -v -race -coverprofile ./coverage.out -covermode=atomic -timeout 20m ./...

.goreleaser.yml

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ archives:
5454
{{- with .Arm }}v{{ . }}{{ end }}
5555
{{- with .Mips }}_{{ . }}{{ end }}
5656
{{- if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}
57-
builds:
57+
ids:
5858
- nvidia_gpu_exporter
5959
format_overrides:
6060
- goos: windows
61-
format: zip
61+
formats:
62+
- zip
6263
files:
6364
- LICENSE
6465

@@ -108,72 +109,63 @@ checksum:
108109
name_template: checksums.txt
109110
algorithm: sha256
110111

112+
git:
113+
ignore_tags: # skip prereleases (alpha, beta, rc) on finding previous commit to generate the changelog
114+
- "*-*"
115+
111116
changelog:
112117
sort: asc
118+
groups:
119+
- title: "New Features"
120+
regexp: '^feat(\(.+\))?:'
121+
order: 0
122+
- title: "Bug Fixes"
123+
regexp: '^fix(\(.+\))?:'
124+
order: 1
125+
- title: "Performance Improvements"
126+
regexp: '^perf(\(.+\))?:'
127+
order: 2
128+
- title: "Documentation"
129+
regexp: '^docs(\(.+\))?:'
130+
order: 3
131+
- title: "Refactors & Internal Changes"
132+
regexp: '^refactor(\(.+\))?:'
133+
order: 4
134+
- title: "Dependency Updates"
135+
regexp: '^chore\(deps\):'
136+
order: 5
137+
- title: "Build, CI & Chores"
138+
regexp: '^(build|ci|cd|cicd|docker|test|chore)(\(.+\))?:'
139+
order: 6
140+
- title: "Other Changes"
141+
order: 999
113142
filters:
114143
exclude:
115-
- '^build(\(.+\))?:'
116-
- '^chore(\(.+\))?:'
117-
- '^cd(\(.+\))?:'
118-
- '^ci(\(.+\))?:'
119-
- '^cicd(\(.+\))?:'
120-
- '^docker(\(.+\))?:'
121-
- '^docs(\(.+\))?:'
122-
- '^refactor(\(.+\))?:'
123-
- '^test(\(.+\))?:'
124144
- Merge pull request
125145
- Merge branch
126146
- go mod tidy
127147

128-
dockers:
129-
- image_templates:
130-
- docker.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-amd64
131-
- ghcr.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-amd64
132-
use: buildx
133-
dockerfile: Dockerfile
134-
build_flag_templates:
135-
- --platform=linux/amd64
136-
- image_templates:
137-
- docker.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-arm64
138-
- ghcr.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-arm64
139-
use: buildx
140-
goarch: arm64
141-
dockerfile: Dockerfile
142-
build_flag_templates:
143-
- --platform=linux/arm64
144-
- image_templates:
145-
- docker.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-armv7
146-
- ghcr.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-armv7
147-
use: buildx
148-
goarch: arm
149-
goarm: "7"
150-
dockerfile: Dockerfile
151-
build_flag_templates:
152-
- --platform=linux/arm/v7
153-
154-
docker_manifests:
155-
- name_template: docker.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}
156-
image_templates:
157-
- docker.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-amd64
158-
- docker.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-arm64
159-
- docker.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-armv7
160-
161-
- name_template: ghcr.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}
162-
image_templates:
163-
- ghcr.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-amd64
164-
- ghcr.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-arm64
165-
- ghcr.io/utkuozdemir/nvidia_gpu_exporter:{{ .Version }}-armv7
148+
dockers_v2:
149+
- images:
150+
- docker.io/utkuozdemir/nvidia_gpu_exporter
151+
- ghcr.io/utkuozdemir/nvidia_gpu_exporter
152+
tags:
153+
- "{{ .Version }}"
154+
- "{{ if not .Prerelease }}latest{{ end }}"
155+
platforms:
156+
- linux/amd64
157+
- linux/arm64
158+
- linux/arm/v7
166159

167-
# To test docker image push, uncomment the following and run
168-
# goreleaser release --skip-validate --rm-dist --debug
169-
#release:
170-
# disable: true
160+
release:
161+
prerelease: auto
171162

172163
scoops:
173164
- repository:
174165
owner: utkuozdemir
175166
name: scoop_nvidia_gpu_exporter
176167
token: "{{ .Env.PRIVATE_ACCESS_TOKEN }}"
168+
skip_upload: auto
177169
commit_author:
178170
name: Utku Ozdemir
179171
email: utkuozdemir@gmail.com

cmd/nvidia_gpu_exporter/main.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ func main() {
4242
if err := run(); err != nil {
4343
slog.Default().Error("failed to run", "err", err)
4444

45-
var exitErr *exec.ExitError
46-
47-
if errors.As(err, &exitErr) {
45+
if exitErr, ok := errors.AsType[*exec.ExitError](err); ok {
4846
os.Exit(exitErr.ExitCode())
4947
}
5048

@@ -190,7 +188,7 @@ type RootHandler struct {
190188

191189
func NewRootHandler(logger *slog.Logger, metricsPath string) *RootHandler {
192190
return &RootHandler{
193-
response: []byte(fmt.Sprintf(redirectPageTemplate, metricsPath)),
191+
response: fmt.Appendf(nil, redirectPageTemplate, metricsPath),
194192
logger: logger,
195193
}
196194
}

go.mod

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/utkuozdemir/nvidia_gpu_exporter
22

3-
go 1.25.0
3+
go 1.26.1
44

55
require (
66
github.com/alecthomas/kingpin/v2 v2.4.0
@@ -19,7 +19,7 @@ require (
1919
github.com/beorn7/perks v1.0.1 // indirect
2020
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2121
github.com/davecgh/go-spew v1.1.1 // indirect
22-
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
22+
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
2323
github.com/google/uuid v1.6.0 // indirect
2424
github.com/jpillora/backoff v1.0.0 // indirect
2525
github.com/mdlayher/socket v0.5.1 // indirect
@@ -28,14 +28,14 @@ require (
2828
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
2929
github.com/pmezard/go-difflib v1.0.0 // indirect
3030
github.com/prometheus/client_model v0.6.2 // indirect
31-
github.com/prometheus/procfs v0.17.0 // indirect
31+
github.com/prometheus/procfs v0.20.1 // indirect
3232
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
33-
go.yaml.in/yaml/v2 v2.4.3 // indirect
34-
golang.org/x/crypto v0.46.0 // indirect
35-
golang.org/x/net v0.48.0 // indirect
36-
golang.org/x/oauth2 v0.34.0 // indirect
37-
golang.org/x/sys v0.39.0 // indirect
38-
golang.org/x/text v0.32.0 // indirect
33+
go.yaml.in/yaml/v2 v2.4.4 // indirect
34+
golang.org/x/crypto v0.48.0 // indirect
35+
golang.org/x/net v0.51.0 // indirect
36+
golang.org/x/oauth2 v0.35.0 // indirect
37+
golang.org/x/sys v0.41.0 // indirect
38+
golang.org/x/text v0.34.0 // indirect
3939
golang.org/x/time v0.14.0 // indirect
4040
google.golang.org/protobuf v1.36.11 // indirect
4141
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7
1111
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1212
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1313
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
14-
github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
15-
github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
14+
github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
15+
github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
1616
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
1717
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
1818
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@@ -47,8 +47,8 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU
4747
github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
4848
github.com/prometheus/exporter-toolkit v0.15.1 h1:XrGGr/qWl8Gd+pqJqTkNLww9eG8vR/CoRk0FubOKfLE=
4949
github.com/prometheus/exporter-toolkit v0.15.1/go.mod h1:P/NR9qFRGbCFgpklyhix9F6v6fFr/VQB/CVsrMDGKo4=
50-
github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0=
51-
github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw=
50+
github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc=
51+
github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
5252
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
5353
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
5454
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -67,20 +67,20 @@ github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8
6767
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
6868
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
6969
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
70-
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
71-
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
72-
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
73-
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
74-
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
75-
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
76-
golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
77-
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
70+
go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
71+
go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
72+
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
73+
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
74+
golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo=
75+
golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y=
76+
golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ=
77+
golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
7878
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
7979
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
80-
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
81-
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
82-
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
83-
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
80+
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
81+
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
82+
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
83+
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
8484
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
8585
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
8686
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=

internal/exporter/exporter.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ func (e *GPUExporter) Collect(metricCh chan<- prometheus.Metric) {
214214
e.failedScrapesTotal.Inc()
215215

216216
if e.shutdownOnErrorFunc != nil {
217-
var exitErr *exec.ExitError
218-
219-
if errors.As(err, &exitErr) {
217+
if _, ok := errors.AsType[*exec.ExitError](err); ok {
220218
e.shutdownOnErrorFunc(err)
221219
}
222220
}
@@ -319,8 +317,7 @@ func scrape(
319317
if err != nil {
320318
exitCode := -1
321319

322-
var exitError *exec.ExitError
323-
if errors.As(err, &exitError) {
320+
if exitError, ok := errors.AsType[*exec.ExitError](err); ok {
324321
exitCode = exitError.ExitCode()
325322
}
326323

internal/exporter/fields.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const (
2424
var (
2525
fieldRegex = regexp.MustCompile(`(?m)\n\s*\n^"([^"]+)"`)
2626

27-
//nolint:gochecknoglobals
27+
//nolint:gochecknoglobals,gosec
2828
fallbackQFieldToRFieldMap = map[QField]RField{
2929
"timestamp": "timestamp",
3030
"driver_version": "driver_version",
@@ -167,8 +167,7 @@ func ParseAutoQFields(
167167

168168
exitCode := -1
169169

170-
var exitError *exec.ExitError
171-
if errors.As(err, &exitError) {
170+
if exitError, ok := errors.AsType[*exec.ExitError](err); ok {
172171
exitCode = exitError.ExitCode()
173172
}
174173

0 commit comments

Comments
 (0)