This works:
var z interface{}
if err := json.NewDecoder(resp.Body).Decode(&z); err != nil {
t.Fatal(err)
}
but this doesn't work:
if err := json.NewDecoder(resp.Body).Decode(&interface{}{}); err != nil {
t.Fatal(err)
}
and this doesn't work:
if err := json.NewDecoder(resp.Body).Decode(&struct{}{}); err != nil {
t.Fatal(err)
}
my goal is to unmarshal to an anonymous variable and discard it, as part of
a test. Is there a way to do this?
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/8f58f470-8055-49bc-a248-92a496473f8bn%40googlegroups.com.