/* * Example of heterogeneous arrayo in golang. * * The trick is simply to create an array that accepts elements that conform * to the naked interface (an interface with no requirements). * * Expected output: * * $ go run array.go * [1 2 3.14 hey {10 20}] * */ package main import "fmt" type foo struct { a int b int } func main() { a := []interface{}{1, 2, 3.14, "hey", foo{10, 20}} fmt.Println(a) }