check / check (push) Failing after 0s
Standard scaffold: script/ entrypoints with the Makefile as thin shims, a Dockerfile whose lint and test phases gate the build, a Gitea CI workflow running script/cibuild, REPO_POLICIES.md, TODO.md, .editorconfig, .dockerignore, LICENSE, wider .gitignore. .golangci.yml is byte-identical to the canonical copy in the prompts repo. 211 lint findings fixed in code: package globals became functions/fields and a cobra command constructor, magic numbers became named constants, ctx is threaded into the probes, monitor loops split. Tests moved to external _test packages with export_test.go. Behavior unchanged. Readers will trip over: make lint/test/check now need a Docker daemon; the personal rsync copy/run targets are gone and make run runs locally. Disclosure: four //nolint:gosec remain on the fixed-argv ping/curl calls and the operator-chosen log file, as the reference repo annotates the same class. Disclosure: module path left as-is. Model: opus-4-8 (implementation); fable-5-1 (merge)
38 lines
1.7 KiB
Docker
38 lines
1.7 KiB
Docker
# Lint phase. golangci-lint runs here, in the pinned linter image, never on
|
|
# the host. script/lint builds this stage by name with --no-cache.
|
|
# golangci/golangci-lint:v2.12.2, 2026-05-06
|
|
FROM golangci/golangci-lint:v2.12.2@sha256:5cceeef04e53efe1470638d4b4b4f5ceefd574955ab3941b2d9a68a8c9ad5240 AS lint
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN golangci-lint config verify --config .golangci.yml
|
|
RUN golangci-lint run --config .golangci.yml ./...
|
|
|
|
# Test phase. script/test builds this stage by name with --no-cache.
|
|
# golang:1.26.1-bookworm, 2026-03-17
|
|
FROM golang:1.26.1-bookworm@sha256:4465644228bc2857a954b092167e12aa59c006a3492282a6c820bf4755fd64a4 AS test
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN go test -count=1 -race -cover -timeout 90s ./... || \
|
|
{ echo "--- Rerunning with -v for details ---"; \
|
|
go test -count=1 -race -v -timeout 90s ./...; exit 1; }
|
|
|
|
# Build stage, and the last one. Nothing is wanted from the phases above;
|
|
# the two copies are the ordering edges that make BuildKit build them first,
|
|
# so this stage cannot build unless lint and test passed. For this
|
|
# non-server tool the final stage is the build/development environment
|
|
# carrying the compiled binary; rtnetmon runs on a host with the privileges
|
|
# to open raw ICMP sockets, not as a container service.
|
|
# golang:1.26.1-bookworm, 2026-03-17
|
|
FROM golang:1.26.1-bookworm@sha256:4465644228bc2857a954b092167e12aa59c006a3492282a6c820bf4755fd64a4 AS builder
|
|
COPY --from=lint /src/go.sum /dev/null
|
|
COPY --from=test /src/go.sum /dev/null
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 go build -trimpath -o /rtnetmon ./cmd/rtnetmon/
|