Fix build: tag the Link_Workflow parse warning - #11750
Closed
stephanos wants to merge 1 commit into
Closed
Conversation
Contributor
|
Claude finished @stephanos's task in 1m 16s —— View job Reviewed 1 file, 1 finding. |
Comment on lines
49
to
54
| logger.Warn( | ||
| fmt.Sprintf("failed to parse link to %q: %s", nexusLink.Type, nexusLink.URL), | ||
| "failed to parse Nexus link", | ||
| tag.Error(err), | ||
| tag.NewStringTag("nexus-link-type", nexusLink.Type), | ||
| tag.URL(nexusLink.URL.String()), | ||
| ) |
Contributor
There was a problem hiding this comment.
nit — This is now the third byte-identical logger.Warn block in one function; worth collapsing.
After #11685 made the message static, the three failure branches differ only in which converter they call — the warn call itself is the same six lines repeated. The nexus-link-type tag already carries everything the reader needs to tell them apart, so the duplication buys nothing.
Fine to leave for the build fix and do separately; flagging since this PR creates the third copy.
Suggestion: Pick the converter in the switch, then convert and log once after it:
var convert func(nexus.Link) (proto.Message, error) // or a small variant-wrapping closure
switch nexusLink.Type {
case ...WorkflowEvent: ...
}
if err != nil {
logger.Warn("failed to parse Nexus link", tag.Error(err),
tag.NewStringTag("nexus-link-type", nexusLink.Type), tag.URL(nexusLink.URL.String()))
continue
}
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.
main is currently broken
go build ./common/nexus/fails onorigin/mainas of fc7b395.Cause
A semantic merge conflict between two PRs that merged around the same time:
fmtimport fromlinks.go, having replaced all threefmt.Sprintfmessage interpolations with log tags.Link_Workflowcase that logs viafmt.Sprintf.Neither diff touched the other's lines, so git merged both cleanly and the result does not compile.
Fix
Convert the new case to the same static-message-plus-tags form as the other three, rather than re-adding the import — that keeps the warning aggregatable in Loki, which is what #11685 was for.
Testing
go build ./...,go test -tags test_dep ./common/nexus/,gofmt. No remainingfmt.references in the file.🤖 Generated with Claude Code