Re: [go-nuts] Embedding any (empty interface) in a struct in Go

2022-10-26 Thread 'Axel Wagner' via golang-nuts
On Wed, Oct 26, 2022 at 9:17 PM sick...@gmail.com wrote: > 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 >

[go-nuts] Embedding any (empty interface) in a struct in Go

2022-10-26 Thread sick...@gmail.com
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,