Update linting

* Update upstream Prometheus golanci-lint CI config.
* Update upstream Prometheus Makefile.commmon.
* Update golangci-lint config.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
SuperQ 2023-08-12 10:34:18 +02:00
parent 05a503e023
commit a9ea7d0e6b
No known key found for this signature in database
GPG Key ID: C646B23C9E3245F1
4 changed files with 30 additions and 9 deletions

View File

@ -1,3 +1,5 @@
---
# This action is synced from https://github.com/prometheus/prometheus
name: golangci-lint name: golangci-lint
on: on:
push: push:
@ -27,4 +29,4 @@ jobs:
- name: Lint - name: Lint
uses: golangci/golangci-lint-action@v3.4.0 uses: golangci/golangci-lint-action@v3.4.0
with: with:
version: v1.51.2 version: v1.53.3

View File

@ -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: issues:
exclude-rules: exclude-rules:
- path: _test.go - path: _test.go
@ -7,4 +20,14 @@ issues:
linters-settings: linters-settings:
errcheck: 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

View File

@ -55,13 +55,13 @@ ifneq ($(shell command -v gotestsum > /dev/null),)
endif endif
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 PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
SKIP_GOLANGCI_LINT := SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT := GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?= GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.51.2 GOLANGCI_LINT_VERSION ?= v1.53.3
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64. # golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
# windows isn't included here because of the path separator being different. # windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))

View File

@ -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