ci: gate go vet and gofmt -s, and fix the vet findings (MAPCO-11498) - #36
Merged
Merged
Conversation
A successful parse hit `continue` before the coordinate assertion, so the test only ever checked errors. go vet reports the assertion as unreachable (MAPCO-11498). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tcase carried an atlas.Atlas, which holds a mutex, and every case copied it by value. No case ever set it. go vet reports the copies (MAPCO-11498). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
signal.Notify never blocks on a send, so with an unbuffered channel a SIGTERM that arrives before signalHandler is receiving is dropped and the process does not shut down. Flagged by go vet (MAPCO-11498). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A value receiver copied the whole observer, sync.Once fields included, on every call. Every other method already takes *observer, and only *observer satisfies the observer interfaces. Flagged by go vet (MAPCO-11498). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unkeyed literal of a type from another package breaks silently if its fields are reordered. go vet's composites check flags it (MAPCO-11498). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A static checks job runs gofmt -s over every tracked Go file outside vendor/ and go vet over the tree. Both were clean only by convention, and vet was not: four kinds of finding had accumulated (MAPCO-11498). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both now fail CI, so say so where contributors look, next to govulncheck (MAPCO-11498). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage Report for CI Build 5Coverage decreased (-0.01%) to 56.74%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: MAPCO-11498
What and why
Formatting and vet were enforced by convention only. The formatting convention held, but vet did not:
go vet -mod vendor ./...reported findings in five places. That is why nothing could gate on it. This PR fixes all five, then makes CI fail on either kind of violation.The vet findings. Each fix is its own commit:
cmd/shigola/cmd/tile_name_format_test.go(unreachable code). A successful parse hitcontinuebefore the coordinate assertion.TestFormatParseonly ever checked errors and never checked the parsed z/x/y. It now checks them. I confirmed the assertion runs by breaking an expected value, which made the test fail.internal/cmd/main.go(unbufferedsignal.Notifychannel). This one is a real bug, not just noise.signal.Notifynever blocks on a send, so a SIGTERM that arrives before the handler goroutine is receiving is dropped. The channel is now buffered.observability/prometheus/prometheus.go(copylocks).Handlerwas the only method with a value receiver, and it copied thesync.Oncefields on every call. It now uses*observerlike every other method.cmd/internal/register/maps_test.go(copylocks).tcasecarried anatlas.Atlas, which holds a mutex, and no case ever set it. The test now creates a fresh atlas per case.internal/env/dict.go(composites). Thedict.ErrKeyTypeliterals now name their fields.The gate. A new
Static checksjob, separate from the test job, so a failure is named in the checks list and shows up in seconds:gofmt -s -lover every tracked Go file outsidevendor/.vendor/is notgofmt -sclean. Listing the files withgit ls-filesavoids piping throughgrep -v, which exits 1 on a clean run under the runner'spipefail.go vet -mod vendor ./...twice. The first run uses the default build. The second sets every opt-out tag pluspprof, so the stub files for compiled-out backends are vetted too.CONTRIBUTING.mdnow lists both as required checks next togovulncheck, using the samegofmtcommand CI runs.Base branch
The base is
development, notmaster.developmentis where current work is integrated, and this branch was cut from it.Verification
All runs used a
golang:1.26.6-bookwormcontainer.CGO_ENABLED=0, and with the full tag set.gofmtscript passes on the tree and fails on a deliberately misformattedtile.go.go test -race ./...withRUN_POSTGIS_TESTS=yes. Everything passes exceptTestValidateTileInGridandserver/ogcTestTile, which are known to fail on arm64 only. Both packages pass on amd64.Left out
staticcheckand no analyzers beyond vet's defaults. The ticket asks for vet.TestFormatParsestill uses a plain loop rather than the repo'sfn := func(tc tcase)subtest pattern. Converting it would widen a vet-fix commit.shigola-docschange. None of the files touched here are sources for docs pages.🤖 Generated with Claude Code