Go deserialization when type is not known
问题 I'm writing a package in go to send messages between services, using a specific type of transport. I'd like the package to not understand the type of messages being sent. My first thought is to serialize the message object into json, send that, deserialize on the receiving end, and pass the go object (as an interface{} ) to the subscribing code. The serialization isn't a problem, but I don't see how the generic package code can deserialize the message since it doesn't know the type. I thought