Check formatting on the latest Go only, the toolchain that defines it
This commit is contained in:
+8
-5
@@ -1,9 +1,10 @@
|
||||
# The merge gate: `docker build .` fails if vet, formatting or tests fail, and CI
|
||||
# runs exactly this. Day-to-day, prefer `docker compose run` (bind-mounts source,
|
||||
# no rebuilds). GO_VERSION defaults to the latest stable Go; override it to test
|
||||
# the lowest supported version: docker build --build-arg GO_VERSION=1.22.12 .
|
||||
# no rebuilds). GO_VERSION defaults to the latest stable Go; the lowest supported
|
||||
# version builds the `portable` stage, which every supported Go must pass:
|
||||
# docker build --build-arg GO_VERSION=1.22.12 --target portable .
|
||||
ARG GO_VERSION=1.27.1
|
||||
FROM golang:${GO_VERSION}
|
||||
FROM golang:${GO_VERSION} AS portable
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -14,6 +15,8 @@ RUN go mod download
|
||||
COPY . .
|
||||
RUN go vet ./... && \
|
||||
go run github.com/fzipp/gocyclo/cmd/gocyclo@v0.6.0 -over 14 -ignore _test . && \
|
||||
{ unformatted="$(gofmt -l .)"; test -z "$unformatted" || \
|
||||
{ echo "unformatted files:"; echo "$unformatted"; exit 1; }; } && \
|
||||
go test -race ./...
|
||||
|
||||
FROM portable
|
||||
RUN unformatted="$(gofmt -l .)"; test -z "$unformatted" || \
|
||||
{ echo "unformatted files:"; echo "$unformatted"; exit 1; }
|
||||
|
||||
Reference in New Issue
Block a user