Skip to content

Commit edc893f

Browse files
authored
Merge pull request #18 from itchyny/fix-readme-examples
Fix usage code in README.md
2 parents a07d3b8 + 2bcbe02 commit edc893f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ func main() {
3434
val, ok := o.Get("a")
3535

3636
// use Keys instead of for k, v := range o
37-
key := o.Keys()
37+
keys := o.Keys()
3838
for _, k := range keys {
3939
v, _ := o.Get(k)
4040
}
4141

4242
// use o.Delete instead of delete(o, key)
43-
err := o.Delete("a")
43+
o.Delete("a")
4444

4545
// serialize to a json string using encoding/json
4646
bytes, err := json.Marshal(o)
47-
prettyBytes, err := json.MarshalIndent(o)
47+
prettyBytes, err := json.MarshalIndent(o, "", " ")
4848

4949
// deserialize a json string using encoding/json
5050
// all maps (including nested maps) will be parsed as orderedmaps
@@ -55,7 +55,7 @@ func main() {
5555
o.SortKeys(sort.Strings)
5656

5757
// sort by Pair
58-
o.Sort(func(a *Pair, b *Pair) bool {
58+
o.Sort(func(a *orderedmap.Pair, b *orderedmap.Pair) bool {
5959
return a.Value().(float64) < b.Value().(float64)
6060
})
6161
}

0 commit comments

Comments
 (0)