Merge pull request #12413 from hashicorp/jbardin/error-sort

Sort Validation warning and errors
This commit is contained in:
James Bardin 2017-03-03 11:40:28 -05:00 committed by GitHub
commit ca4841b9b0
1 changed files with 6 additions and 0 deletions

View File

@ -665,6 +665,12 @@ func (c *Context) Validate() ([]string, []error) {
// Return the result
rerrs := multierror.Append(errs, walker.ValidationErrors...)
sort.Strings(walker.ValidationWarnings)
sort.Slice(rerrs.Errors, func(i, j int) bool {
return rerrs.Errors[i].Error() < rerrs.Errors[j].Error()
})
return walker.ValidationWarnings, rerrs.Errors
}