Add isdefault + fix fqdn

Closes #299
Fixes #306
pull/307/head
Dean Karn 7 years ago
parent 0d09605a05
commit f16354ec03
  1. 4
      baked_in.go
  2. 1
      validator_test.go

@ -1494,6 +1494,10 @@ func isHostname(fl FieldLevel) bool {
func isFQDN(fl FieldLevel) bool { func isFQDN(fl FieldLevel) bool {
val := fl.Field().String() val := fl.Field().String()
if val == "" {
return false
}
if val[len(val)-1] == '.' { if val[len(val)-1] == '.' {
val = val[0 : len(val)-1] val = val[0 : len(val)-1]
} }

@ -7189,6 +7189,7 @@ func TestFQDNValidation(t *testing.T) {
{"2001:cdba:0000:0000:0000:0000:3257:9652", false}, {"2001:cdba:0000:0000:0000:0000:3257:9652", false},
{"2001:cdba:0:0:0:0:3257:9652", false}, {"2001:cdba:0:0:0:0:3257:9652", false},
{"2001:cdba::3257:9652", false}, {"2001:cdba::3257:9652", false},
{"", false},
} }
validate := New() validate := New()

Loading…
Cancel
Save