I've just tried doing something like this in my code:

// Token is an OAuth2 token which includes decoding the expires_in attribute
type Token struct {
oauth2.Token
ExpiresIn int `json:"expires_in"` // expiration time in seconds
}

func (t *Token) UnmarshalJSON(data []byte) error {
...
}

type WrappedToken Token

Only to find out, that unmarshaling a WrappedToken does not call 
Token.UnmarshalJSON which came as a bit of surprise.

I can only guess it's due to how JSON unmarshaling works, but is this the 
intended behaviour?

Kind regards,
Andreas

-- 
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/0ceb1917-af61-4259-8695-55eeb0bd6bffn%40googlegroups.com.

Reply via email to