am using a protobuf definition file to create golang classes
file.proto
message my_message {
<what type to use?> data = 1 [json_name = "data"]
}
generated.go
type MyMessage struct {
data any
}
I have checked out Struct , Value and Any, though none of them actually mark the type as “any” in generated classes.
The closes I get is Value type which can accomodate primitives as well as structs and lists.
As far as I'm aware the Go code generator doesn't have any circumstances where
any/interface{}will be used for a generated field.google.protobuf.Anyis likely what you want here, but the field in the generated code will of typeanypb.Any. If you absolutely require theanytype be used, you'll unfortunately have to manually map to another struct.