Skip to content

Go: fix RPC handling of left padded operator enums#7797

Merged
greg-at-moderne merged 1 commit into
mainfrom
greg-rewrite-go-rpc-left-padded-operator-enums
May 27, 2026
Merged

Go: fix RPC handling of left padded operator enums#7797
greg-at-moderne merged 1 commit into
mainfrom
greg-rewrite-go-rpc-left-padded-operator-enums

Conversation

@greg-at-moderne
Copy link
Copy Markdown
Contributor

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

What's changed?

Fix Go RPC logic to properly handle left-padded operator enums.

What's your motivation?

Panics are raised when running Go recipes in Moderne CLI, e.g.

2026/05/27 11:40:25 PANIC in Print: interface conversion: interface {} is tree.LeftPadded[github.com/openrewrite/rewrite/rewrite-go/pkg/tree.J], not tree.LeftPadded[github.com/openrewrite/rewrite/rewrite-go/pkg/tree.BinaryOperator]
goroutine 1 [running]:
main.(*server).safeHandleRequest.func1()
        rewrite-recipe-workspace/cmd/rpc/main.go:404 +0x84
panic({0x103340820?, 0x140004492f0?})
        runtime/panic.go:783 +0x120
github.com/openrewrite/rewrite/rewrite-go/pkg/rpc.(*JavaReceiver).VisitBinary(0x14000350d40, 0x140003fc1e0, {0x103381700?, 0x1400049f980})
        github.com/openrewrite/rewrite/rewrite-go@v0.0.1/pkg/rpc/java_receiver.go:149 +0x2f0
github.com/openrewrite/rewrite/rewrite-go/pkg/visitor.(*GoVisitor).Visit(0x14000350d40, {0x103436940, 0x140004283c0}, {0x103381700, 0x1400049f980})

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite May 27, 2026
@greg-at-moderne greg-at-moderne marked this pull request as ready for review May 27, 2026 10:20
@greg-at-moderne greg-at-moderne merged commit 295eca9 into main May 27, 2026
1 check passed
@greg-at-moderne greg-at-moderne deleted the greg-rewrite-go-rpc-left-padded-operator-enums branch May 27, 2026 10:20
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite May 27, 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