diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 202ae2366..5b2345d82 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,11 @@ updates: directory: "/" schedule: interval: "monthly" + - package-ecosystem: "gomod" + directory: "/examples/middleware" + schedule: + interval: "monthly" + - package-ecosystem: "gomod" + directory: "/tutorial/whatsup" + schedule: + interval: "monthly" diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 29e1f564e..279a784d6 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -25,9 +25,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - name: install Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.20.x - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' @@ -35,4 +35,4 @@ jobs: uses: golangci/golangci-lint-action@v3.4.0 with: args: --verbose - version: v1.51.2 + version: v1.53.3 diff --git a/.go-version b/.go-version deleted file mode 100644 index d2ab029d3..000000000 --- a/.go-version +++ /dev/null @@ -1 +0,0 @@ -1.21 diff --git a/.golangci.yml b/.golangci.yml index 7e1953030..075c1e34b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,14 +1,15 @@ --- - run: deadline: 5m + skip-files: + # Skip autogenerated files. + - ^.*\.(pb|y)\.go$ output: sort-results: true linters: enable: - - deadcode - depguard - durationcheck - errorlint @@ -23,10 +24,8 @@ linters: - predeclared - revive - staticcheck - - structcheck - unconvert - unused - - varcheck - wastedassign issues: @@ -39,9 +38,29 @@ issues: - structcheck linters-settings: + depguard: + rules: + main: + deny: + #- pkg: "sync/atomic" + # desc: "Use go.uber.org/atomic instead of sync/atomic" + - pkg: "github.com/stretchr/testify/assert" + desc: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert" + - pkg: "github.com/go-kit/kit/log" + desc: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log" + - pkg: "io/ioutil" + desc: "Use corresponding 'os' or 'io' functions instead." + #- pkg: "regexp" + # desc: "Use github.com/grafana/regexp instead of regexp" errcheck: exclude: scripts/errcheck_excludes.txt goimports: local-prefixes: github.com/prometheus/client_golang gofumpt: extra-rules: true + revive: + rules: + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter + - name: unused-parameter + severity: warning + disabled: true diff --git a/Makefile b/Makefile index 4cfdc1f44..09614813d 100644 --- a/Makefile +++ b/Makefile @@ -24,9 +24,9 @@ test-short: deps common-test-short VERSIONS := 1.19 1.20 1.21 generate-go-collector-test-files: for GO_VERSION in $(VERSIONS); do \ - docker run --rm -v $(PWD):/workspace -w /workspace golang:$$GO_VERSION go run prometheus/gen_go_collector_metrics_set.go; \ + docker run --rm -v $(PWD):/workspace -w /workspace golang:$$GO_VERSION go run prometheus/gen_go_collector_metrics_set.go; \ mv -f go_collector_metrics* prometheus; \ - done + done .PHONY: fmt fmt: common-format diff --git a/examples/middleware/go.mod b/examples/middleware/go.mod index 718b3ae65..ecc5d9ee2 100644 --- a/examples/middleware/go.mod +++ b/examples/middleware/go.mod @@ -1,6 +1,6 @@ module github.com/jessicalins/instrumentation-practices-examples/middleware -go 1.17 +go 1.19 require github.com/prometheus/client_golang v1.13.1 diff --git a/go.mod b/go.mod index 9c354dfaf..ba604d377 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/prometheus/client_golang -go 1.17 +go 1.19 require ( github.com/beorn7/perks v1.0.1