Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 442e588

Browse files
committed
Fix some failures
1 parent 58fb9bd commit 442e588

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

error.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package mapstructure
22

33
import (
44
"fmt"
5+
"sort"
56
"strings"
67
)
78

@@ -17,6 +18,7 @@ func (e *Error) Error() string {
1718
points[i] = fmt.Sprintf("* %s", err)
1819
}
1920

21+
sort.Strings(points)
2022
return fmt.Sprintf(
2123
"%d error(s) decoding:\n\n%s",
2224
len(e.Errors), strings.Join(points, "\n"))

mapstructure_examples_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ func ExampleDecode_errors() {
6262
// Output:
6363
// 5 error(s) decoding:
6464
//
65-
// * 'Name' expected type 'string', got unconvertible type 'int'
6665
// * 'Age' expected type 'int', got unconvertible type 'string'
6766
// * 'Emails[0]' expected type 'string', got unconvertible type 'int'
6867
// * 'Emails[1]' expected type 'string', got unconvertible type 'int'
6968
// * 'Emails[2]' expected type 'string', got unconvertible type 'int'
69+
// * 'Name' expected type 'string', got unconvertible type 'int'
7070
}
7171

7272
func ExampleDecode_metadata() {

mapstructure_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,8 @@ func TestMetadata(t *testing.T) {
690690
t.Fatalf("err: %s", err.Error())
691691
}
692692

693-
expectedKeys := []string{"Vfoo", "Vbar.Vstring", "Vbar.Vuint", "Vbar"}
693+
expectedKeys := []string{"Vbar", "Vbar.Vstring", "Vbar.Vuint", "Vfoo"}
694+
sort.Strings(md.Keys)
694695
if !reflect.DeepEqual(md.Keys, expectedKeys) {
695696
t.Fatalf("bad keys: %#v", md.Keys)
696697
}

0 commit comments

Comments
 (0)