From 1570c9b6b3280eff74a7b601dd6925543616d72a Mon Sep 17 00:00:00 2001 From: joeybloggs Date: Mon, 9 Nov 2015 12:27:18 -0500 Subject: [PATCH] Update Error message quotes to single quotes * helps reduce noise when transmitting errors via JSON. for #199 --- util.go | 4 ++-- validator.go | 2 +- validator_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/util.go b/util.go index 96ab20e..6719787 100644 --- a/util.go +++ b/util.go @@ -13,8 +13,8 @@ const ( leftBracket = "[" rightBracket = "]" restrictedTagChars = ".[],|=+()`~!@#$%^&*\\\"/?<>{}" - restrictedAliasErr = "Alias \"%s\" either contains restricted characters or is the same as a restricted tag needed for normal operation" - restrictedTagErr = "Tag \"%s\" either contains restricted characters or is the same as a restricted tag needed for normal operation" + restrictedAliasErr = "Alias '%s' either contains restricted characters or is the same as a restricted tag needed for normal operation" + restrictedTagErr = "Tag '%s' either contains restricted characters or is the same as a restricted tag needed for normal operation" ) var ( diff --git a/validator.go b/validator.go index cb79e64..6329986 100644 --- a/validator.go +++ b/validator.go @@ -30,7 +30,7 @@ const ( skipValidationTag = "-" diveTag = "dive" existsTag = "exists" - fieldErrMsg = "Key: \"%s\" Error:Field validation for \"%s\" failed on the \"%s\" tag" + fieldErrMsg = "Key: '%s' Error:Field validation for '%s' failed on the '%s' tag" arrayIndexFieldName = "%s" + leftBracket + "%d" + rightBracket mapIndexFieldName = "%s" + leftBracket + "%v" + rightBracket invalidValidation = "Invalid validation tag on field %s" diff --git a/validator_test.go b/validator_test.go index 8a631bf..bac8d46 100644 --- a/validator_test.go +++ b/validator_test.go @@ -252,7 +252,7 @@ func TestAliasTags(t *testing.T) { NotEqual(t, errs, nil) AssertError(t, errs, "[0]", "[0]", "iscolor") - PanicMatches(t, func() { validate.RegisterAliasValidation("exists", "gt=5,lt=10") }, "Alias \"exists\" either contains restricted characters or is the same as a restricted tag needed for normal operation") + PanicMatches(t, func() { validate.RegisterAliasValidation("exists", "gt=5,lt=10") }, "Alias 'exists' either contains restricted characters or is the same as a restricted tag needed for normal operation") } func TestNilValidator(t *testing.T) { @@ -4040,7 +4040,7 @@ func TestAddFunctions(t *testing.T) { errs = validate.RegisterValidation("new", fn) Equal(t, errs, nil) - PanicMatches(t, func() { validate.RegisterValidation("dive", fn) }, "Tag \"dive\" either contains restricted characters or is the same as a restricted tag needed for normal operation") + PanicMatches(t, func() { validate.RegisterValidation("dive", fn) }, "Tag 'dive' either contains restricted characters or is the same as a restricted tag needed for normal operation") } func TestChangeTag(t *testing.T) {