Skip to content

Commit 4abd83d

Browse files
authored
Update building (#1326)
* Remove unused / non-standard .go-version. * Cleanup indenting in Makefile. * Enable dependabot for subdirs. * Update golanci-lint CI. * Update go.mod version directives to match supported versions. * Disable golanci-lint unused-parameter. Signed-off-by: SuperQ <[email protected]>
1 parent 6f576e2 commit 4abd83d

File tree

8 files changed

+38
-405
lines changed

8 files changed

+38
-405
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "monthly"
7+
- package-ecosystem: "gomod"
8+
directory: "/examples/middleware"
9+
schedule:
10+
interval: "monthly"
11+
- package-ecosystem: "gomod"
12+
directory: "/tutorial/whatsup"
13+
schedule:
14+
interval: "monthly"

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525
- name: Checkout repository
2626
uses: actions/checkout@v3
2727
- name: install Go
28-
uses: actions/setup-go@v2
28+
uses: actions/setup-go@v3
2929
with:
30-
go-version: 1.18.x
30+
go-version: 1.20.x
3131
- name: Install snmp_exporter/generator dependencies
3232
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
3333
if: github.repository == 'prometheus/snmp_exporter'
3434
- name: Lint
3535
uses: golangci/[email protected]
3636
with:
3737
args: --verbose
38-
version: v1.51.2
38+
version: v1.53.3

.go-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.golangci.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
2-
32
run:
43
deadline: 5m
4+
skip-files:
5+
# Skip autogenerated files.
6+
- ^.*\.(pb|y)\.go$
57

68
output:
79
sort-results: true
810

911
linters:
1012
enable:
11-
- deadcode
1213
- depguard
1314
- durationcheck
1415
- errorlint
@@ -23,10 +24,8 @@ linters:
2324
- predeclared
2425
- revive
2526
- staticcheck
26-
- structcheck
2727
- unconvert
2828
- unused
29-
- varcheck
3029
- wastedassign
3130

3231
issues:
@@ -39,9 +38,29 @@ issues:
3938
- structcheck
4039

4140
linters-settings:
41+
depguard:
42+
rules:
43+
main:
44+
deny:
45+
#- pkg: "sync/atomic"
46+
# desc: "Use go.uber.org/atomic instead of sync/atomic"
47+
- pkg: "github.com/stretchr/testify/assert"
48+
desc: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert"
49+
- pkg: "github.com/go-kit/kit/log"
50+
desc: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log"
51+
- pkg: "io/ioutil"
52+
desc: "Use corresponding 'os' or 'io' functions instead."
53+
#- pkg: "regexp"
54+
# desc: "Use github.com/grafana/regexp instead of regexp"
4255
errcheck:
4356
exclude: scripts/errcheck_excludes.txt
4457
goimports:
4558
local-prefixes: github.com/prometheus/client_golang
4659
gofumpt:
4760
extra-rules: true
61+
revive:
62+
rules:
63+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
64+
- name: unused-parameter
65+
severity: warning
66+
disabled: true

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ test-short: deps common-test-short
2424
VERSIONS := 1.19 1.20 1.21
2525
generate-go-collector-test-files:
2626
for GO_VERSION in $(VERSIONS); do \
27-
docker run --rm -v $(PWD):/workspace -w /workspace golang:$$GO_VERSION go run prometheus/gen_go_collector_metrics_set.go; \
27+
docker run --rm -v $(PWD):/workspace -w /workspace golang:$$GO_VERSION go run prometheus/gen_go_collector_metrics_set.go; \
2828
mv -f go_collector_metrics* prometheus; \
29-
done
29+
done
3030

3131
.PHONY: fmt
3232
fmt: common-format

examples/middleware/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/jessicalins/instrumentation-practices-examples/middleware
22

3-
go 1.17
3+
go 1.19
44

55
require github.com/prometheus/client_golang v1.13.1
66

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/client_golang
22

3-
go 1.17
3+
go 1.19
44

55
require (
66
github.com/beorn7/perks v1.0.1

go.sum

Lines changed: 0 additions & 393 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)