github.com/gmemcc/yaegi@v0.12.1-0.20221128122509-aa99124c5d16/_test/for3.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "sort" 6 ) 7 8 func main() { 9 m := map[string][]string{ 10 "hello": []string{"foo", "bar"}, 11 "world": []string{"truc", "machin"}, 12 } 13 14 var content []string 15 16 for key, values := range m { 17 for _, value := range values { 18 content = append(content, key+value) 19 } 20 } 21 22 sort.Strings(content) 23 fmt.Println(content) 24 } 25 26 // Output: 27 // [hellobar hellofoo worldmachin worldtruc]