Skip to content

Commit 1570c9b

Browse files
joeybloggsjoeybloggs
authored andcommitted
Update Error message quotes to single quotes
* helps reduce noise when transmitting errors via JSON. for #199
1 parent d5305ab commit 1570c9b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const (
1313
leftBracket = "["
1414
rightBracket = "]"
1515
restrictedTagChars = ".[],|=+()`~!@#$%^&*\\\"/?<>{}"
16-
restrictedAliasErr = "Alias \"%s\" either contains restricted characters or is the same as a restricted tag needed for normal operation"
17-
restrictedTagErr = "Tag \"%s\" either contains restricted characters or is the same as a restricted tag needed for normal operation"
16+
restrictedAliasErr = "Alias '%s' either contains restricted characters or is the same as a restricted tag needed for normal operation"
17+
restrictedTagErr = "Tag '%s' either contains restricted characters or is the same as a restricted tag needed for normal operation"
1818
)
1919

2020
var (

validator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const (
3030
skipValidationTag = "-"
3131
diveTag = "dive"
3232
existsTag = "exists"
33-
fieldErrMsg = "Key: \"%s\" Error:Field validation for \"%s\" failed on the \"%s\" tag"
33+
fieldErrMsg = "Key: '%s' Error:Field validation for '%s' failed on the '%s' tag"
3434
arrayIndexFieldName = "%s" + leftBracket + "%d" + rightBracket
3535
mapIndexFieldName = "%s" + leftBracket + "%v" + rightBracket
3636
invalidValidation = "Invalid validation tag on field %s"

validator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func TestAliasTags(t *testing.T) {
252252
NotEqual(t, errs, nil)
253253
AssertError(t, errs, "[0]", "[0]", "iscolor")
254254

255-
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")
255+
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")
256256
}
257257

258258
func TestNilValidator(t *testing.T) {
@@ -4040,7 +4040,7 @@ func TestAddFunctions(t *testing.T) {
40404040
errs = validate.RegisterValidation("new", fn)
40414041
Equal(t, errs, nil)
40424042

4043-
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")
4043+
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")
40444044
}
40454045

40464046
func TestChangeTag(t *testing.T) {

0 commit comments

Comments
 (0)