diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 100cf93..433f71b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,3 +1,5 @@ +--- +# This action is synced from https://github.com/prometheus/prometheus name: golangci-lint on: push: @@ -27,4 +29,4 @@ jobs: - name: Lint uses: golangci/golangci-lint-action@v3.4.0 with: - version: v1.51.2 + version: v1.53.3 diff --git a/.golangci.yml b/.golangci.yml index 883547a..3f7e458 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,17 @@ ---- +linters: + enable: + - misspell + - revive + disable: + # Disable soon to deprecated[1] linters that lead to false + # positives when build tags disable certain files[2] + # 1: https://github.com/golangci/golangci-lint/issues/1841 + # 2: https://github.com/prometheus/node_exporter/issues/1545 + - deadcode + - unused + - structcheck + - varcheck + issues: exclude-rules: - path: _test.go @@ -7,4 +20,14 @@ issues: linters-settings: errcheck: - exclude: scripts/errcheck_excludes.txt + exclude-functions: + # Used in HTTP handlers, any error is handled by the server itself. + - (net/http.ResponseWriter).Write + # Never check for logger errors. + - (github.com/go-kit/log.Logger).Log + 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.common b/Makefile.common index 787feff..0ce7ea4 100644 --- a/Makefile.common +++ b/Makefile.common @@ -55,7 +55,7 @@ ifneq ($(shell command -v gotestsum > /dev/null),) endif endif -PROMU_VERSION ?= 0.14.0 +PROMU_VERSION ?= 0.15.0 PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz SKIP_GOLANGCI_LINT := diff --git a/scripts/errcheck_excludes.txt b/scripts/errcheck_excludes.txt deleted file mode 100644 index 14b824f..0000000 --- a/scripts/errcheck_excludes.txt +++ /dev/null @@ -1,4 +0,0 @@ -// Used in HTTP handlers, any error is handled by the server itself. -(net/http.ResponseWriter).Write -// Never check for logger errors. -(github.com/go-kit/log.Logger).Log