Last active
February 27, 2025 19:38
-
-
Save cslarsen/5256744 to your computer and use it in GitHub Desktop.
Revisions
-
cslarsen revised this gist
Mar 27, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ /* * Example of heterogeneous arrayo in golang. * * The trick is simply to create an array that accepts elements that conform -
cslarsen created this gist
Mar 27, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ * * 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) }