From 642e8fcd8902b813ed43e6945d7a14b9877cd287 Mon Sep 17 00:00:00 2001 From: kristinaspring Date: Tue, 16 Apr 2019 11:36:27 -0700 Subject: [PATCH] Fixed joining error strings (#16) --- bascule/error.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bascule/error.go b/bascule/error.go index 7f1457d..47f5d39 100644 --- a/bascule/error.go +++ b/bascule/error.go @@ -1,6 +1,9 @@ package bascule -import "fmt" +import ( + "fmt" + "strings" +) // Error is an optional interface to be implemented by security related errors type Error interface { @@ -15,11 +18,11 @@ type MultiError interface { type Errors []error func (e Errors) Error() string { - var errors string + var errors []string for _, err := range e { - errors = errors + ", " + err.Error() + errors = append(errors, err.Error()) } - return fmt.Sprintf("multiple errors: [%v]", errors) + return fmt.Sprintf("multiple errors: [%v]", strings.Join(errors, ", ")) } func (e Errors) Errors() []error {