Consider a scenario where you want to embed an error within any type of 
variable.

This can be achieved by embedding any in a struct and it seems to be a 
valid syntax in Go 1.9.
    type WithError struct { 
        any 
        err error
    } 
    func main() { 
        a := WithError{ any: 5, err: nil, } 
        fmt.Printf("%+v\n", a)
    } 

Does this violate any community best practices? 
Is there an alternative pattern that can achieve a similar result?

-- 
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/0a6bbea5-c37b-4ce4-89d6-2b44d7868639n%40googlegroups.com.

Reply via email to