Update golanci-lint (#3632)
Update golangci-lint from upstream Prometheus and fixup issues. Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
parent
83486834de
commit
0c6393b3f4
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
# This action is synced from https://github.com/prometheus/prometheus
|
||||
name: golangci-lint
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
paths:
|
||||
- "go.sum"
|
||||
- "go.mod"
|
||||
|
@ -8,6 +10,7 @@ on:
|
|||
- "scripts/errcheck_excludes.txt"
|
||||
- ".github/workflows/golangci-lint.yml"
|
||||
- ".golangci.yml"
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
golangci:
|
||||
|
@ -15,13 +18,15 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- name: install Go
|
||||
uses: actions/setup-go@v2
|
||||
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
||||
with:
|
||||
go-version: 1.21.x
|
||||
- run: make build
|
||||
- name: Install snmp_exporter/generator dependencies
|
||||
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
|
||||
if: github.repository == 'prometheus/snmp_exporter'
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v3.4.0
|
||||
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
|
||||
with:
|
||||
version: v1.51.2
|
||||
version: v1.54.2
|
||||
|
|
|
@ -23,12 +23,15 @@ issues:
|
|||
|
||||
linters-settings:
|
||||
depguard:
|
||||
list-type: blacklist
|
||||
include-go-root: true
|
||||
packages-with-error-message:
|
||||
- sync/atomic: "Use go.uber.org/atomic instead of sync/atomic"
|
||||
- github.com/stretchr/testify/assert: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert"
|
||||
- github.com/go-kit/kit/log: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log"
|
||||
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"
|
||||
errcheck:
|
||||
exclude-functions:
|
||||
# Don't flag lines such as "io.Copy(io.Discard, resp.Body)".
|
||||
|
@ -52,7 +55,6 @@ linters-settings:
|
|||
arguments: ["disableStutteringCheck"]
|
||||
- name: blank-imports
|
||||
- name: context-as-argument
|
||||
- name: dot-imports
|
||||
- name: error-return
|
||||
- name: error-strings
|
||||
- name: error-naming
|
||||
|
|
|
@ -55,13 +55,13 @@ 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 :=
|
||||
GOLANGCI_LINT :=
|
||||
GOLANGCI_LINT_OPTS ?=
|
||||
GOLANGCI_LINT_VERSION ?= v1.51.2
|
||||
GOLANGCI_LINT_VERSION ?= v1.55.2
|
||||
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
|
||||
# windows isn't included here because of the path separator being different.
|
||||
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
|
||||
|
|
|
@ -58,7 +58,7 @@ import (
|
|||
"github.com/prometheus/alertmanager/timeinterval"
|
||||
"github.com/prometheus/alertmanager/types"
|
||||
"github.com/prometheus/alertmanager/ui"
|
||||
reactApp "github.com/prometheus/alertmanager/ui/react-app"
|
||||
reactapp "github.com/prometheus/alertmanager/ui/react-app"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -500,7 +500,7 @@ func run() int {
|
|||
webReload := make(chan chan error)
|
||||
|
||||
ui.Register(router, webReload, logger)
|
||||
reactApp.Register(router, logger)
|
||||
reactapp.Register(router, logger)
|
||||
|
||||
mux := api.Register(router, *routePrefix)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
// DO NOT EDIT: This file was autogenerated by `scripts/compress_assets.sh`.
|
||||
|
||||
package reactApp
|
||||
package reactapp
|
||||
|
||||
import "embed"
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
// DO NOT EDIT: This file was autogenerated by `scripts/compress_assets.sh`.
|
||||
|
||||
package reactApp
|
||||
package reactapp
|
||||
|
||||
import "embed"
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package reactApp
|
||||
package reactapp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package reactApp
|
||||
package reactapp
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
Loading…
Reference in New Issue