Files
moxa/_test/for3.go
Ludovic Fernandez e78753ffd8 test: add consistency tests. (#46)
* test: add consistency tests.

* skip: cli1 due to bug.

* refactor: rename test.

* refactor: map and for.
2019-01-25 16:41:41 +01:00

28 lines
398 B
Go

package main
import (
"fmt"
"sort"
)
func main() {
m := map[string][]string{
"hello": []string{"foo", "bar"},
"world": []string{"truc", "machin"},
}
var content []string
for key, values := range m {
for _, value := range values {
content = append(content, key+value)
}
}
sort.Strings(content)
fmt.Println(content)
}
// Output:
// [hellobar hellofoo worldmachin worldtruc]