Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6932e3adce |
+1
-1
@@ -6,7 +6,7 @@ COPY go.mod go.sum ./
|
|||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN make fmt-check
|
RUN make fmt-check
|
||||||
# Called directly: make lint is itself a docker build of this stage.
|
# Called directly: make lint is itself a docker build (Dockerfile.lint).
|
||||||
RUN golangci-lint run --config .golangci.yml ./...
|
RUN golangci-lint run --config .golangci.yml ./...
|
||||||
|
|
||||||
# Test stage: run full test suite
|
# Test stage: run full test suite
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# Built by script/lint. The build runs golangci-lint, so a successful build
|
||||||
|
# is a clean lint.
|
||||||
|
#
|
||||||
|
# `golangci-lint config verify` is left out on purpose: it downloads its
|
||||||
|
# schema over the network on every run, unpinned.
|
||||||
|
#
|
||||||
|
# golangci/golangci-lint:v2.12.2 (Debian-based), 2026-08-07
|
||||||
|
FROM golangci/golangci-lint:v2.12.2@sha256:5cceeef04e53efe1470638d4b4b4f5ceefd574955ab3941b2d9a68a8c9ad5240
|
||||||
|
WORKDIR /src
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
COPY . .
|
||||||
|
RUN golangci-lint run --config .golangci.yml ./...
|
||||||
@@ -121,18 +121,17 @@ alpine. We provide:
|
|||||||
- `script/projectname` — output the project name (our own extension); used by
|
- `script/projectname` — output the project name (our own extension); used by
|
||||||
`script/docker` for the image tag
|
`script/docker` for the image tag
|
||||||
- `script/test` — run the test suite (`go test -v ./...`)
|
- `script/test` — run the test suite (`go test -v ./...`)
|
||||||
- `script/lint` — run golangci-lint in Docker by building only the `lint`
|
- `script/lint` — run golangci-lint in Docker by building `Dockerfile.lint`
|
||||||
stage of the `Dockerfile` (which also runs the format check), without the
|
without the build cache, so every run lints; keeps no image
|
||||||
build cache, so every run lints; the image is tagged `simplelog-lint`
|
|
||||||
- `script/fmt` — format all files with goimports (writes)
|
- `script/fmt` — format all files with goimports (writes)
|
||||||
- `script/fmt-check` — check formatting (read-only); fails if `gofmt -l`
|
- `script/fmt-check` — check formatting (read-only); fails if `gofmt -l`
|
||||||
reports files
|
reports files
|
||||||
- `script/check` — run all checks: `test`, `lint`, `fmt-check` (our own
|
- `script/check` — run all checks: `test`, `lint`, `fmt-check` (our own
|
||||||
extension)
|
extension)
|
||||||
- `script/docker` — build the Docker image without the build cache, tagged
|
- `script/docker` — build the Docker image, tagged via `script/projectname`
|
||||||
via `script/projectname` (byte-identical across repos)
|
(byte-identical across repos)
|
||||||
- `script/cibuild` — cd to the repo root and `docker build --no-cache .` (what
|
- `script/cibuild` — cd to the repo root and `docker build .` (what CI runs;
|
||||||
CI runs; the image build runs the checks)
|
the image build runs the checks)
|
||||||
- `script/precommit` — run by the git pre-commit hook (our own extension);
|
- `script/precommit` — run by the git pre-commit hook (our own extension);
|
||||||
runs a `go mod tidy` guard, then `script/check`
|
runs a `go mod tidy` guard, then `script/check`
|
||||||
- `script/install-precommit` — installs the git pre-commit hook (our own
|
- `script/install-precommit` — installs the git pre-commit hook (our own
|
||||||
|
|||||||
@@ -24,10 +24,9 @@ files it depends on: .golangci.yml, REPO_POLICIES.md, .editorconfig,
|
|||||||
|
|
||||||
# Completed Steps
|
# Completed Steps
|
||||||
|
|
||||||
* 2026-10-06: the linter runs only in Docker: `script/lint` builds the
|
* 2026-10-06: the linter runs only in Docker: `script/lint` builds
|
||||||
`lint` stage of the `Dockerfile`, every `docker build` in `script/`
|
`Dockerfile.lint` without the build cache, and `script/bootstrap` no
|
||||||
runs without the build cache, and `script/bootstrap` no longer
|
longer installs golangci-lint
|
||||||
installs golangci-lint
|
|
||||||
* 2026-08-10: fixed every handler discarding slog attributes: console,
|
* 2026-08-10: fixed every handler discarding slog attributes: console,
|
||||||
JSON and webhook handlers now emit record attributes, accumulate
|
JSON and webhook handlers now emit record attributes, accumulate
|
||||||
WithAttrs without mutating the receiver, and honour WithGroup;
|
WithAttrs without mutating the receiver, and honour WithGroup;
|
||||||
|
|||||||
+1
-2
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# script/cibuild: run the CI build. The Dockerfile runs the format check,
|
# script/cibuild: run the CI build. The Dockerfile runs the format check,
|
||||||
# the linter and the tests, so a successful build means they all pass.
|
# the linter and the tests, so a successful build means they all pass.
|
||||||
# --no-cache because a cached check step is a check that did not run.
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
docker build --no-cache .
|
docker build .
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# script/docker: build the Docker image tagged with the project name.
|
# script/docker: build the Docker image tagged with the project name.
|
||||||
# Identical in all repos; the tag comes from script/projectname.
|
# Identical in all repos; the tag comes from script/projectname.
|
||||||
# --no-cache because a cached check step is a check that did not run.
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
||||||
@@ -9,7 +8,7 @@ ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
docker build --no-cache -t "$("$SCRIPT_DIR/projectname")" .
|
docker build -t "$("$SCRIPT_DIR/projectname")" .
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
+6
-10
@@ -1,19 +1,15 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# script/lint: run the linter, in docker only, by building the lint stage
|
# script/lint: run the linter, in docker only, by building Dockerfile.lint;
|
||||||
# of the Dockerfile and nothing else; the build fails on any finding.
|
# the build fails on any finding. --no-cache makes every run execute the
|
||||||
# --no-cache makes every run execute the linter: a cached build of an
|
# linter: a cached build of an unchanged tree succeeds without linting
|
||||||
# unchanged tree succeeds without linting anything. The tag makes each
|
# anything. --output type=cacheonly keeps no image.
|
||||||
# build replace the previous image instead of leaving an untagged one.
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
||||||
ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
docker build --no-cache \
|
docker build --no-cache --output type=cacheonly -f Dockerfile.lint .
|
||||||
--target lint \
|
|
||||||
-t "$("$SCRIPT_DIR/projectname")-lint" .
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user