From a88ce5439d5e867f14e2a0af51d0be0de768e82e Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Wed, 13 Sep 2017 21:48:52 -0700 Subject: [PATCH] fix multierror merge --- nomad/structs/funcs.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nomad/structs/funcs.go b/nomad/structs/funcs.go index bc57c2804..751befd65 100644 --- a/nomad/structs/funcs.go +++ b/nomad/structs/funcs.go @@ -18,10 +18,6 @@ import ( // MergeMultierrorWarnings takes job warnings and canonicalize warnings and // merges them into a returnable string. Both the errors may be nil. func MergeMultierrorWarnings(warnings ...error) string { - if len(warnings) == 0 { - return "" - } - var warningMsg multierror.Error for _, warn := range warnings { if warn != nil { @@ -29,6 +25,10 @@ func MergeMultierrorWarnings(warnings ...error) string { } } + if len(warningMsg.Errors) == 0 { + return "" + } + // Set the formatter warningMsg.ErrorFormat = warningsFormatter return warningMsg.Error()