Skip to content

Commit 8c190af

Browse files
committed
Update and fix linting issues.
Update Go to 1.25. Signed-off-by: SuperQ <[email protected]>
1 parent 4537c89 commit 8c190af

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ executors:
66
# This must match .promu.yml.
77
golang:
88
docker:
9-
- image: cimg/go:1.23
9+
- image: cimg/go:1.25
1010
jobs:
1111
test:
1212
executor: golang

.golangci.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1+
version: "2"
12
linters:
23
enable:
34
- revive
45
- sloglint
5-
6-
issues:
7-
exclude-rules:
8-
- path: _test.go
9-
linters:
10-
- errcheck
11-
12-
linters-settings:
13-
errcheck:
14-
exclude-functions:
15-
# Used in HTTP handlers, any error is handled by the server itself.
16-
- (net/http.ResponseWriter).Write
17-
revive:
6+
settings:
7+
errcheck:
8+
exclude-functions:
9+
- (net/http.ResponseWriter).Write
10+
revive:
11+
rules:
12+
- name: unused-parameter
13+
disabled: true
14+
exclusions:
15+
generated: lax
16+
presets:
17+
- comments
18+
- common-false-positives
19+
- legacy
20+
- std-error-handling
1821
rules:
19-
- name: unused-parameter
20-
disabled: true
22+
- linters:
23+
- errcheck
24+
path: _test.go
25+
formatters:
26+
exclusions:
27+
generated: lax

.promu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
go:
22
# This must match .circle/config.yml.
3-
version: 1.23
3+
version: 1.25
44
repository:
55
path: github.com/prometheus-community/json_exporter
66
build:

Makefile.common

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ common-all: precheck style check_license lint yamllint unused build test
112112
.PHONY: common-style
113113
common-style:
114114
@echo ">> checking code style"
115-
@fmtRes=$$($(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print)); \
115+
@fmtRes=$$($(GOFMT) -d $$(git ls-files '*.go' ':!:vendor/*' || find . -path ./vendor -prune -o -name '*.go' -print)); \
116116
if [ -n "$${fmtRes}" ]; then \
117117
echo "gofmt checking failed!"; echo "$${fmtRes}"; echo; \
118118
echo "Please ensure you are using $$($(GO) version) for formatting code."; \
@@ -122,7 +122,7 @@ common-style:
122122
.PHONY: common-check_license
123123
common-check_license:
124124
@echo ">> checking license header"
125-
@licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
125+
@licRes=$$(for file in $$(git ls-files '*.go' ':!:vendor/*' || find . -path ./vendor -prune -o -type f -iname '*.go' -print) ; do \
126126
awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
127127
done); \
128128
if [ -n "$${licRes}" ]; then \

exporter/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func CreateMetricsList(c config.Module) ([]JSONMetric, error) {
133133
metrics = append(metrics, jsonMetric)
134134
}
135135
default:
136-
return nil, fmt.Errorf("Unknown metric type: '%s', for metric: '%s'", metric.Type, metric.Name)
136+
return nil, fmt.Errorf("unknown metric type: '%s', for metric: '%s'", metric.Type, metric.Name)
137137
}
138138
}
139139
return metrics, nil

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/prometheus-community/json_exporter
22

3-
go 1.22.0
3+
go 1.24.0
44

55
require (
66
github.com/Masterminds/sprig/v3 v3.3.0

0 commit comments

Comments
 (0)