Skip to content

Commit

Permalink
slice: use unordered output in an example
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Feb 19, 2024
1 parent 924d12c commit 2132017
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions slice/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package slice_test

import (
"fmt"
"sort"
"strings"

"github.com/creachadair/mds/slice"
Expand Down Expand Up @@ -53,11 +52,10 @@ func ExampleMatchingKeys() {
vs := map[string]int{"red": 3, "yellow": 6, "blue": 4, "green": 5}

keys := slice.MatchingKeys(vs, isEven)
sort.Strings(keys) // sort so test output is stable
for _, key := range keys {
fmt.Println(key, vs[key])
}
// Output:
// Unordered output:
// blue 4
// yellow 6
}
Expand Down

0 comments on commit 2132017

Please sign in to comment.