@@ -131,7 +131,7 @@ func (r Required) IsSatisfied(obj interface{}) bool {
131131
132132// DefaultMessage return the default error message
133133func (r Required ) DefaultMessage () string {
134- return fmt . Sprint ( MessageTmpls ["Required" ])
134+ return MessageTmpls ["Required" ]
135135}
136136
137137// GetKey return the r.Key
@@ -350,7 +350,7 @@ func (a Alpha) IsSatisfied(obj interface{}) bool {
350350
351351// DefaultMessage return the default Length error message
352352func (a Alpha ) DefaultMessage () string {
353- return fmt . Sprint ( MessageTmpls ["Alpha" ])
353+ return MessageTmpls ["Alpha" ]
354354}
355355
356356// GetKey return the m.Key
@@ -383,7 +383,7 @@ func (n Numeric) IsSatisfied(obj interface{}) bool {
383383
384384// DefaultMessage return the default Length error message
385385func (n Numeric ) DefaultMessage () string {
386- return fmt . Sprint ( MessageTmpls ["Numeric" ])
386+ return MessageTmpls ["Numeric" ]
387387}
388388
389389// GetKey return the n.Key
@@ -416,7 +416,7 @@ func (a AlphaNumeric) IsSatisfied(obj interface{}) bool {
416416
417417// DefaultMessage return the default Length error message
418418func (a AlphaNumeric ) DefaultMessage () string {
419- return fmt . Sprint ( MessageTmpls ["AlphaNumeric" ])
419+ return MessageTmpls ["AlphaNumeric" ]
420420}
421421
422422// GetKey return the a.Key
@@ -481,7 +481,7 @@ func (n NoMatch) GetLimitValue() interface{} {
481481 return n .Regexp .String ()
482482}
483483
484- var alphaDashPattern = regexp .MustCompile (" [^\\ d \\ w-_]" )
484+ var alphaDashPattern = regexp .MustCompile (` [^\d\ w-_]` )
485485
486486// AlphaDash check not Alpha
487487type AlphaDash struct {
@@ -491,7 +491,7 @@ type AlphaDash struct {
491491
492492// DefaultMessage return the default AlphaDash error message
493493func (a AlphaDash ) DefaultMessage () string {
494- return fmt . Sprint ( MessageTmpls ["AlphaDash" ])
494+ return MessageTmpls ["AlphaDash" ]
495495}
496496
497497// GetKey return the n.Key
@@ -504,7 +504,7 @@ func (a AlphaDash) GetLimitValue() interface{} {
504504 return nil
505505}
506506
507- var emailPattern = regexp .MustCompile ("[ \\ w!#$%&'*+/=?^_` {|}~-]+(?:\\ .[\\ w!#$%&'*+/=?^_` {|}~-]+)*@(?:[\\ w](?:[\\ w-]*[\\ w])?\\ .)+[a-zA-Z0-9](?:[\\ w-]*[\\ w])?" )
507+ var emailPattern = regexp .MustCompile (`[\ w!#$%&'*+/=?^_{|}~-]+(?:\.[\w!#$%&'*+/=?^_{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[a-zA-Z0-9](?:[\w-]*[\w])?` )
508508
509509// Email check struct
510510type Email struct {
@@ -514,7 +514,7 @@ type Email struct {
514514
515515// DefaultMessage return the default Email error message
516516func (e Email ) DefaultMessage () string {
517- return fmt . Sprint ( MessageTmpls ["Email" ])
517+ return MessageTmpls ["Email" ]
518518}
519519
520520// GetKey return the n.Key
@@ -527,7 +527,7 @@ func (e Email) GetLimitValue() interface{} {
527527 return nil
528528}
529529
530- var ipPattern = regexp .MustCompile (" ^((2[0-4]\\ d|25[0-5]|[01]?\\ d \\ d?)\\ .){3}(2[0-4]\\ d|25[0-5]|[01]?\\ d \\ d?)$" )
530+ var ipPattern = regexp .MustCompile (` ^((2[0-4]\d|25[0-5]|[01]?\d\ d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\ d?)$` )
531531
532532// IP check struct
533533type IP struct {
@@ -537,7 +537,7 @@ type IP struct {
537537
538538// DefaultMessage return the default IP error message
539539func (i IP ) DefaultMessage () string {
540- return fmt . Sprint ( MessageTmpls ["IP" ])
540+ return MessageTmpls ["IP" ]
541541}
542542
543543// GetKey return the i.Key
@@ -550,7 +550,7 @@ func (i IP) GetLimitValue() interface{} {
550550 return nil
551551}
552552
553- var base64Pattern = regexp .MustCompile (" ^(?:[A-Za-z0-99+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" )
553+ var base64Pattern = regexp .MustCompile (` ^(?:[A-Za-z0-99+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$` )
554554
555555// Base64 check struct
556556type Base64 struct {
@@ -560,7 +560,7 @@ type Base64 struct {
560560
561561// DefaultMessage return the default Base64 error message
562562func (b Base64 ) DefaultMessage () string {
563- return fmt . Sprint ( MessageTmpls ["Base64" ])
563+ return MessageTmpls ["Base64" ]
564564}
565565
566566// GetKey return the b.Key
@@ -574,7 +574,7 @@ func (b Base64) GetLimitValue() interface{} {
574574}
575575
576576// just for chinese mobile phone number
577- var mobilePattern = regexp .MustCompile (" ^((\\ +86)|(86))?(1(([35][0-9])|[8][0-9]|[7][06789]|[4][579]))\\ d{8}$" )
577+ var mobilePattern = regexp .MustCompile (` ^((\+86)|(86))?(1(([35][0-9])|[8][0-9]|[7][06789]|[4][579]))\d{8}$` )
578578
579579// Mobile check struct
580580type Mobile struct {
@@ -584,7 +584,7 @@ type Mobile struct {
584584
585585// DefaultMessage return the default Mobile error message
586586func (m Mobile ) DefaultMessage () string {
587- return fmt . Sprint ( MessageTmpls ["Mobile" ])
587+ return MessageTmpls ["Mobile" ]
588588}
589589
590590// GetKey return the m.Key
@@ -598,7 +598,7 @@ func (m Mobile) GetLimitValue() interface{} {
598598}
599599
600600// just for chinese telephone number
601- var telPattern = regexp .MustCompile (" ^(0\\ d{2,3}(\\ -)?)?\\ d{7,8}$" )
601+ var telPattern = regexp .MustCompile (` ^(0\d{2,3}(\-)?)?\d{7,8}$` )
602602
603603// Tel check telephone struct
604604type Tel struct {
@@ -608,7 +608,7 @@ type Tel struct {
608608
609609// DefaultMessage return the default Tel error message
610610func (t Tel ) DefaultMessage () string {
611- return fmt . Sprint ( MessageTmpls ["Tel" ])
611+ return MessageTmpls ["Tel" ]
612612}
613613
614614// GetKey return the t.Key
@@ -635,7 +635,7 @@ func (p Phone) IsSatisfied(obj interface{}) bool {
635635
636636// DefaultMessage return the default Phone error message
637637func (p Phone ) DefaultMessage () string {
638- return fmt . Sprint ( MessageTmpls ["Phone" ])
638+ return MessageTmpls ["Phone" ]
639639}
640640
641641// GetKey return the p.Key
@@ -649,7 +649,7 @@ func (p Phone) GetLimitValue() interface{} {
649649}
650650
651651// just for chinese zipcode
652- var zipCodePattern = regexp .MustCompile (" ^[1-9]\\ d{5}$" )
652+ var zipCodePattern = regexp .MustCompile (` ^[1-9]\d{5}$` )
653653
654654// ZipCode check the zip struct
655655type ZipCode struct {
@@ -659,7 +659,7 @@ type ZipCode struct {
659659
660660// DefaultMessage return the default Zip error message
661661func (z ZipCode ) DefaultMessage () string {
662- return fmt . Sprint ( MessageTmpls ["ZipCode" ])
662+ return MessageTmpls ["ZipCode" ]
663663}
664664
665665// GetKey return the z.Key
0 commit comments