mirror of https://github.com/perkeep/perkeep.git
jsonconfig: sort unknown keys when returning errors
Change-Id: I5930e8b6c18581e2b9901b4d7ebc1e02af7a7be6
This commit is contained in:
parent
374c1f5360
commit
f877e849d6
|
@ -20,6 +20,7 @@ package jsonconfig
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -230,6 +231,7 @@ func (jc Obj) lookForUnknownKeys() {
|
||||||
if ok {
|
if ok {
|
||||||
known = ei.(map[string]bool)
|
known = ei.(map[string]bool)
|
||||||
}
|
}
|
||||||
|
var unknown []string
|
||||||
for k, _ := range jc {
|
for k, _ := range jc {
|
||||||
if ok && known[k] {
|
if ok && known[k] {
|
||||||
continue
|
continue
|
||||||
|
@ -239,6 +241,10 @@ func (jc Obj) lookForUnknownKeys() {
|
||||||
// form of comments.
|
// form of comments.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
unknown = append(unknown, k)
|
||||||
|
}
|
||||||
|
sort.Strings(unknown)
|
||||||
|
for _, k := range unknown {
|
||||||
jc.appendError(fmt.Errorf("Unknown key %q", k))
|
jc.appendError(fmt.Errorf("Unknown key %q", k))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue