Skip to content

Fix build: tag the Link_Workflow parse warning - #11750

Closed
stephanos wants to merge 1 commit into
mainfrom
stephanos/fix-links-fmt-merge
Closed

Fix build: tag the Link_Workflow parse warning#11750
stephanos wants to merge 1 commit into
mainfrom
stephanos/fix-links-fmt-merge

Conversation

@stephanos

Copy link
Copy Markdown
Contributor

main is currently broken

common/nexus/links.go:50:6: undefined: fmt

go build ./common/nexus/ fails on origin/main as of fc7b395.

Cause

A semantic merge conflict between two PRs that merged around the same time:

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 remaining fmt. references in the file.

🤖 Generated with Claude Code

#11685 removed the fmt import while #11274 added a Link_Workflow case
using fmt.Sprintf. Both merged cleanly and main stopped compiling.

Convert the new case to tags, matching the other three.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@stephanos
stephanos requested review from a team as code owners August 24, 2026 16:33
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Claude finished @stephanos's task in 1m 16s —— View job


Reviewed 1 file, 1 finding.
stephanos/fix-links-fmt-merge

Comment thread common/nexus/links.go
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()),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
}

@stephanos stephanos closed this Aug 24, 2026
@stephanos
stephanos deleted the stephanos/fix-links-fmt-merge branch August 24, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant