update golangci-lint to 1.54.2

also update config to show all issues at once and
set same exlucde rules as buildkit ones.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2023-10-19 12:24:07 +02:00 committed by CrazyMax
parent fc7144f61d
commit 6e5aefbb98
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 33 additions and 9 deletions

View File

@ -26,12 +26,13 @@ linters:
linters-settings:
depguard:
list-type: blacklist
include-go-root: true
packages:
rules:
main:
deny:
# The io/ioutil package has been deprecated.
# https://go.dev/doc/go1.16#ioutil
- io/ioutil
- pkg: "io/ioutil"
desc: The io/ioutil package has been deprecated.
forbidigo:
forbid:
- '^fmt\.Errorf(# use errors\.Errorf instead)?$'
@ -47,3 +48,22 @@ issues:
- linters:
- revive
text: "stutters"
- linters:
- revive
text: "empty-block"
- linters:
- revive
text: "superfluous-else"
- linters:
- revive
text: "unused-parameter"
- linters:
- revive
text: "redefines-builtin-id"
- linters:
- revive
text: "if-return"
# show all
max-issues-per-linter: 0
max-same-issues: 0

View File

@ -1,10 +1,14 @@
# syntax=docker/dockerfile:1
ARG GO_VERSION=1.21.3
ARG GOLANGCI_LINT_VERSION=1.54.2
FROM golang:${GO_VERSION}-alpine
RUN apk add --no-cache git gcc musl-dev
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.51.1
ENV GOFLAGS="-buildvcs=false"
ARG GOLANGCI_LINT_VERSION
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION}
WORKDIR /go/src/github.com/docker/buildx
RUN --mount=target=/go/src/github.com/docker/buildx --mount=target=/root/.cache,type=cache \
RUN --mount=target=/go/src/github.com/docker/buildx \
--mount=target=/root/.cache,type=cache \
golangci-lint run