Fix some failures
diff --git a/error.go b/error.go
index 3460799..f97c416 100644
--- a/error.go
+++ b/error.go
@@ -2,6 +2,7 @@
import (
"fmt"
+ "sort"
"strings"
)
@@ -17,6 +18,7 @@
points[i] = fmt.Sprintf("* %s", err)
}
+ sort.Strings(points)
return fmt.Sprintf(
"%d error(s) decoding:\n\n%s",
len(e.Errors), strings.Join(points, "\n"))
diff --git a/mapstructure_examples_test.go b/mapstructure_examples_test.go
index a8a61fa..f17c214 100644
--- a/mapstructure_examples_test.go
+++ b/mapstructure_examples_test.go
@@ -62,11 +62,11 @@
// Output:
// 5 error(s) decoding:
//
- // * 'Name' expected type 'string', got unconvertible type 'int'
// * 'Age' expected type 'int', got unconvertible type 'string'
// * 'Emails[0]' expected type 'string', got unconvertible type 'int'
// * 'Emails[1]' expected type 'string', got unconvertible type 'int'
// * 'Emails[2]' expected type 'string', got unconvertible type 'int'
+ // * 'Name' expected type 'string', got unconvertible type 'int'
}
func ExampleDecode_metadata() {
diff --git a/mapstructure_test.go b/mapstructure_test.go
index 23029c7..036e6b5 100644
--- a/mapstructure_test.go
+++ b/mapstructure_test.go
@@ -690,7 +690,8 @@
t.Fatalf("err: %s", err.Error())
}
- expectedKeys := []string{"Vfoo", "Vbar.Vstring", "Vbar.Vuint", "Vbar"}
+ expectedKeys := []string{"Vbar", "Vbar.Vstring", "Vbar.Vuint", "Vfoo"}
+ sort.Strings(md.Keys)
if !reflect.DeepEqual(md.Keys, expectedKeys) {
t.Fatalf("bad keys: %#v", md.Keys)
}