[Bug]: Go SDK registration panics on anonymous structs.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 196
Description
### What happened?
Using `register.Function` (and presumable any other registration function) on an anonymous struct causes a panic immediately. This happens because anonymous types are unregisterable, but the problem is that with generic registration, types are registered from these function signatures, which means any functions with anonymous parameters can't be registered at all, and therefore any types that only appear in the function signature are in effect unregisterable.
The preference here would be for unregisterable parameters to simply be skipped, and for registration to fail gracefully. That is, register everything that can be registered and skip everything that can't (ideally with warnings explaining what isn't being registered).
Example abbreviated stacktrace:
```
panic: invalid registration type: struct { Counter *int64 "beam:\"counter\""; Rand_data *struct { Flip *bool "beam:\"flip\""; Num *int64 "beam:\"num\""; Word *string "beam:\"word\"" } "beam:\"rand_data\"" }
goroutine 1 [running]:
github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime.RegisterType({0x118ecb8?, 0xe7df60?})
{...}/beam/sdks/go/pkg/beam/core/runtime/types.go:39 +0x24e
github.com/apache/beam/sdks/v2/go/pkg/beam/register.registerMethodTypes({0x118ecb8, 0xda8280})
{...}/beam/sdks/go/pkg/beam/register/register.go:8487 +0xba
github.com/apache/beam/sdks/v2/go/pkg/beam/register.Function1x1[...](0x104db10?)
{...}/beam/sdks/go/pkg/beam/register/register.go:3258 +0xc5
```
### Issue Priority
Priority: 2
### Issue Component
Component: sdk-go
Contributor guide
Assessment
This issue has not been assessed yet.