fix(log): stop the cache commands doubling the space in their messages (MAPCO-11672) - #35
Merged
Merged
Conversation
…s (MAPCO-11672)
Error, Warn, Info and Debug now join their operands as Println does, which
always inserts a space. The cache commands' messages already ended in one
("zoom list: ", zooms), so they logged "zoom list: [10 11 12]" rather than
the single-spaced line MAPCO-11672 expects.
The helpers keep Println rather than the ticket's suggested fmt.Sprint:
Sprint puts no space next to a string operand, so ("could not purge", err)
would read "could not purgeboom". The call sites change instead, and the
helper comment and README now state the rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage Report for CI Build 537337546Coverage remained the same at 56.751%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.
What and why
MAPCO-11672 reported that
log.Error/Warn/Info/Debugemitted!BADKEY, turned the message into an attribute key, and panicked onlog.Error(err). That core fix already landed in #32 (MAPCO-11544). There the helpers switched to joining their operands asfmt.Printlndoes, andTestWrappersnow covers!BADKEY, theError(err)panic and the zero-argument call.One thing the ticket expects still failed. Four call sites in the cache commands end their message in a space (
log.Info("zoom list: ", zooms)). Println adds a space of its own, so they loggedzoom list: [10 11 12]where the ticket expectszoom list: [10 11 12]. This PR drops the trailing space at those sites.The ticket suggested
fmt.Sprintinstead, which would have needed no call-site changes. It was rejected because Sprint puts no space next to a string operand:log.Warn("could not purge", err)would readcould not purgeboom, andprovider.go:115would readUnsupported tile SRID.3857. The rule (a message must not end in a space) is now stated in the helper's comment and ininternal/log/README.md.Verification
go build -mod vendor ./...go test -mod vendor -race ./...(full suite, no provider gates), plusCGO_ENABLED=0for./internal/log/ ./cmd/...gofmt -s -lis clean.fcall site outsidevendor/was checked by reading it: none now ends its message in a space.Left out
provider.go:121still renders the*tile_tas a&{...}struct dump. This behaviour predates this PR and the ticket does not cover it.shigola-docschange:internal/log/README.mdis not in the docs-sync table.Jira: MAPCO-11672
🤖 Generated with Claude Code