Hi All, I've created a simple struct that wraps time.Time because I'd like to unmarshal it differently from JSON than the default. It works great.
However, when I pass a type alias of that struct to json.Marshal or json.Unmarshal, the MarshalJSON and UnmarshalJSON functions aren't invoked, despite both types conforming to the interfaces. Here's the shortest example I could make. https://go.dev/play/p/pETWQB3CWxV This is where this came up: https://github.com/deepmap/oapi-codegen/issues/579 I did find a workaround, in redeclaring the MarshalJSON/UnmarshalJSON on the aliased type, but I don't understand why this is necessary, and I'm hoping someone who understands the innards of this better than I do could enlighten me. Thanks, -- Marcin -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LuOa9sHFWxPxqYq_HtiQZ6_pUhCtMUOAL8Yq1X_UvyjJw%40mail.gmail.com.