mirror of https://github.com/docker/buildx.git
fix issues in .golangci.yml and add validation check
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
fa392a2dca
commit
0d37d68efd
|
@ -1,12 +1,8 @@
|
||||||
run:
|
run:
|
||||||
timeout: 30m
|
timeout: 30m
|
||||||
skip-files:
|
|
||||||
- ".*\\.pb\\.go$"
|
|
||||||
|
|
||||||
modules-download-mode: vendor
|
modules-download-mode: vendor
|
||||||
|
|
||||||
build-tags:
|
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- gofmt
|
- gofmt
|
||||||
|
@ -57,6 +53,8 @@ linters-settings:
|
||||||
G306: "0644"
|
G306: "0644"
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
|
exclude-files:
|
||||||
|
- ".*\\.pb\\.go$"
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
- linters:
|
- linters:
|
||||||
- revive
|
- revive
|
||||||
|
@ -77,6 +75,6 @@ issues:
|
||||||
- revive
|
- revive
|
||||||
text: "if-return"
|
text: "if-return"
|
||||||
|
|
||||||
# show all
|
# show all
|
||||||
max-issues-per-linter: 0
|
max-issues-per-linter: 0
|
||||||
max-same-issues: 0
|
max-same-issues: 0
|
||||||
|
|
|
@ -31,7 +31,7 @@ group "default" {
|
||||||
}
|
}
|
||||||
|
|
||||||
group "validate" {
|
group "validate" {
|
||||||
targets = ["lint", "lint-gopls", "validate-vendor", "validate-docs"]
|
targets = ["lint", "lint-gopls", "validate-golangci", "validate-vendor", "validate-docs"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "lint" {
|
target "lint" {
|
||||||
|
@ -51,6 +51,14 @@ target "lint" {
|
||||||
] : []
|
] : []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target "validate-golangci" {
|
||||||
|
description = "Validate .golangci.yml schema (does not run Go linter)"
|
||||||
|
inherits = ["_common"]
|
||||||
|
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
|
||||||
|
target = "validate-golangci"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
|
|
||||||
target "lint-gopls" {
|
target "lint-gopls" {
|
||||||
inherits = ["lint"]
|
inherits = ["lint"]
|
||||||
target = "gopls-analyze"
|
target = "gopls-analyze"
|
||||||
|
|
|
@ -13,18 +13,24 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
|
||||||
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS golang-base
|
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS golang-base
|
||||||
RUN apk add --no-cache git gcc musl-dev
|
RUN apk add --no-cache git gcc musl-dev
|
||||||
|
|
||||||
FROM golang-base AS lint
|
FROM golang-base AS lint-base
|
||||||
ENV GOFLAGS="-buildvcs=false"
|
ENV GOFLAGS="-buildvcs=false"
|
||||||
ARG GOLANGCI_LINT_VERSION
|
ARG GOLANGCI_LINT_VERSION
|
||||||
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION}
|
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION}
|
||||||
COPY --link --from=xx / /
|
COPY --link --from=xx / /
|
||||||
WORKDIR /go/src/github.com/docker/buildx
|
WORKDIR /go/src/github.com/docker/buildx
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
|
FROM lint-base AS lint
|
||||||
RUN --mount=target=/go/src/github.com/docker/buildx \
|
RUN --mount=target=/go/src/github.com/docker/buildx \
|
||||||
--mount=target=/root/.cache,type=cache,id=lint-cache-$TARGETPLATFORM \
|
--mount=target=/root/.cache,type=cache,id=lint-cache-$TARGETPLATFORM \
|
||||||
xx-go --wrap && \
|
xx-go --wrap && \
|
||||||
golangci-lint run
|
golangci-lint run
|
||||||
|
|
||||||
|
FROM lint-base AS validate-golangci
|
||||||
|
RUN --mount=target=/go/src/github.com/docker/buildx \
|
||||||
|
golangci-lint config verify
|
||||||
|
|
||||||
FROM golang-base AS gopls
|
FROM golang-base AS gopls
|
||||||
RUN apk add --no-cache git
|
RUN apk add --no-cache git
|
||||||
ARG GOPLS_VERSION
|
ARG GOPLS_VERSION
|
||||||
|
|
Loading…
Reference in New Issue