diff --git a/.golangci.yml b/.golangci.yml index f82887de..f4d908f9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,12 +26,13 @@ linters: linters-settings: depguard: - list-type: blacklist - include-go-root: true - packages: - # The io/ioutil package has been deprecated. - # https://go.dev/doc/go1.16#ioutil - - io/ioutil + rules: + main: + deny: + # The io/ioutil package has been deprecated. + # https://go.dev/doc/go1.16#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 diff --git a/hack/dockerfiles/lint.Dockerfile b/hack/dockerfiles/lint.Dockerfile index b0d5d7f2..7e46879d 100644 --- a/hack/dockerfiles/lint.Dockerfile +++ b/hack/dockerfiles/lint.Dockerfile @@ -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 \ - golangci-lint run +RUN --mount=target=/go/src/github.com/docker/buildx \ + --mount=target=/root/.cache,type=cache \ + golangci-lint run