Is there a generic type Object
in golang similar to other languages that can be assigned any kind of payload?
type Foo struct {
data object
}
Is there a generic type Object
in golang similar to other languages that can be assigned any kind of payload?
type Foo struct {
data object
}
All Go types implement the empty interface interface{}
.
type Foo struct {
data interface{}
}
The empty interface is covered in A Tour of Go, The Laws of Reflection and the specification.