Skip to content

Go: don't pick the container variant off the first element#7783

Merged
greg-at-moderne merged 1 commit into
mainfrom
greg-go-rpc-container-variant-no-drop-v2
May 26, 2026
Merged

Go: don't pick the container variant off the first element#7783
greg-at-moderne merged 1 commit into
mainfrom
greg-go-rpc-container-variant-no-drop-v2

Conversation

@greg-at-moderne
Copy link
Copy Markdown
Contributor

@greg-at-moderne greg-at-moderne commented May 26, 2026

What's changed?

Stops containerFromElements (part of the RPC) from picking the container variant off the first element (which silently drops Statement-only entries like Return/If when the first element is an Expression).

What's your motivation?

Otherwise, RPC failures are observed when running Go recipes. The symptoms might include:

org.openrewrite.internal.RecipeRunException: java.lang.NullPointerException: Cannot invoke "org.openrewrite.java.tree.J.getId()" because the return value of "org.openrewrite.java.tree.JRightPadded.getElement()" is null
        at org.openrewrite.TreeVisitor.visit(TreeVisitor.java:278)
        at org.openrewrite.golang.internal.rpc.GolangSender$GolangSenderDelegate.visit(GolangSender.java:235)
        at org.openrewrite.golang.internal.rpc.GolangSender$GolangSenderDelegate.visit(GolangSender.java:223)
        at org.openrewrite.java.internal.rpc.JavaSender.lambda$visitRightPadded$296(JavaSender.java:606)
        at org.openrewrite.rpc.RpcSendQueue.lambda$getAndSend$0(RpcSendQueue.java:83)

@greg-at-moderne greg-at-moderne self-assigned this May 26, 2026
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite May 26, 2026
@greg-at-moderne greg-at-moderne marked this pull request as ready for review May 26, 2026 11:39
@greg-at-moderne greg-at-moderne merged commit 2d62513 into main May 26, 2026
@greg-at-moderne greg-at-moderne deleted the greg-go-rpc-container-variant-no-drop-v2 branch May 26, 2026 11:39
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant