Skip to content

Commit c6a510f

Browse files
Dean KarnDean Karn
Dean Karn
authored and
Dean Karn
committed
Merge pull request #65 from bluesuncorp/v5-development
V5 development
2 parents 6ae296c + d401219 commit c6a510f

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

validator.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ func (v *Validate) fieldWithNameAndValue(val interface{}, current interface{}, f
438438

439439
param := ""
440440
if len(vals) > 1 {
441-
param = strings.TrimSpace(vals[1])
441+
param = vals[1]
442442
}
443443

444444
cTag.keyVals[i] = []string{key, param}
@@ -506,12 +506,12 @@ func (v *Validate) fieldWithNameAndSingleTag(val interface{}, current interface{
506506

507507
if err := valFunc(val, current, f, param); err {
508508
return nil, nil
509-
} else {
510-
return &FieldError{
511-
Field: name,
512-
Tag: key,
513-
Value: f,
514-
Param: param,
515-
}, errors.New(key)
516509
}
510+
511+
return &FieldError{
512+
Field: name,
513+
Tag: key,
514+
Value: f,
515+
Param: param,
516+
}, errors.New(key)
517517
}

validator_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ func TestExcludesAllValidation(t *testing.T) {
276276
t.Fatalf("Index: %d failed Error: %s", i, errs)
277277
}
278278
}
279+
280+
username := "joeybloggs "
281+
282+
err := validate.Field(username, "excludesall=@ ")
283+
NotEqual(t, err, nil)
279284
}
280285

281286
func TestExcludesValidation(t *testing.T) {

0 commit comments

Comments
 (0)