Skip to content

Commit 0f2e258

Browse files
authored
Merge pull request #270 from prometheus-community/superq/lint
Update golanci-lint
2 parents 5c49d0c + eaeb03c commit 0f2e258

File tree

3 files changed

+44
-36
lines changed

3 files changed

+44
-36
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,21 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout repository
27-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
persist-credentials: false
2830
- name: Install Go
29-
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
31+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
3032
with:
31-
go-version: 1.22.x
33+
go-version: 1.25.x
3234
- name: Install snmp_exporter/generator dependencies
3335
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
3436
if: github.repository == 'prometheus/snmp_exporter'
37+
- name: Get golangci-lint version
38+
id: golangci-lint-version
39+
run: echo "version=$(make print-golangci-lint-version)" >> $GITHUB_OUTPUT
3540
- name: Lint
36-
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
41+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
3742
with:
3843
args: --verbose
39-
version: v1.59.1
44+
version: ${{ steps.golangci-lint-version.outputs.version }}

.golangci.yml

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,50 @@
1-
run:
2-
skip-dirs:
3-
- internal/vendored
1+
version: "2"
42
linters:
5-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
6-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
7-
disable-all: true
3+
default: none
84
enable:
5+
- asciicheck
96
- bodyclose
107
- depguard
118
- dogsled
129
- errcheck
1310
- funlen
11+
- gochecknoglobals
1412
- gochecknoinits
1513
- goconst
1614
- gocyclo
17-
- gofmt
18-
- goimports
15+
- godot
16+
- godox
1917
- goprintffuncname
2018
- gosec
21-
- gosimple
2219
- govet
2320
- ineffassign
2421
- misspell
22+
- prealloc
2523
- rowserrcheck
2624
- staticcheck
27-
- stylecheck
28-
- typecheck
2925
- unconvert
3026
- unparam
3127
- unused
3228
- whitespace
33-
- asciicheck
34-
- gochecknoglobals
35-
- godot
36-
- godox
37-
- prealloc
38-
# don't enable:
39-
# - testpackage
40-
# - wsl
41-
# - lll
42-
# - gomnd
43-
# - nestif
44-
# - goerr113
45-
#
46-
linters-settings:
47-
depguard:
48-
rules:
49-
main:
50-
deny:
51-
- pkg: "golang.org/x/exp/slices"
52-
desc: "Use 'slices' instead."
29+
settings:
30+
depguard:
31+
rules:
32+
main:
33+
deny:
34+
- pkg: golang.org/x/exp/slices
35+
desc: Use 'slices' instead.
36+
exclusions:
37+
generated: lax
38+
presets:
39+
- comments
40+
- common-false-positives
41+
- legacy
42+
- std-error-handling
43+
paths:
44+
- internal/vendored
45+
formatters:
46+
enable:
47+
- gofmt
48+
- goimports
49+
exclusions:
50+
generated: lax

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ STATIK_FILES := $(patsubst %, %_statik/statik.go, $(STATIK_SRCS))
66

77
BINARYS := $(patsubst cmd/%.go, %, $(MAIN_GO_FILES))
88

9+
GOLANGCI_LINT_VERSION ?= v2.6.0
910

1011
all: build test
1112

@@ -88,3 +89,7 @@ crossbuild:
8889
.PHONY: release
8990
release:
9091
goreleaser
92+
93+
.PHONY: golangci-lint-version
94+
golangci-lint-version:
95+
@echo $(GOLANGCI_LINT_VERSION)

0 commit comments

Comments
 (0)