You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2019/11/15 16:03:43 UTC

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #4107: Adding ability to use zone root records

ocket8888 commented on a change in pull request #4107: Adding ability to use zone root records
URL: https://github.com/apache/trafficcontrol/pull/4107#discussion_r346894468
 
 

 ##########
 File path: traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go
 ##########
 @@ -106,7 +107,7 @@ func (staticDNSEntry TOStaticDNSEntry) Validate() error {
 	}
 
 	errs := validation.Errors{
-		"host":              validation.Validate(staticDNSEntry.Host, validation.Required),
+		"host":              validation.Validate(staticDNSEntry.Host, validation.Required, validation.Match(regexp.MustCompile(`^([a-zA-Z0-9_@*]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*[\._]?$`))),
 
 Review comment:
   you can just use [`github.com/go-ozzo/ozzo-validation/is.DNSName`](https://godoc.org/github.com/go-ozzo/ozzo-validation/is#pkg-variables) instead of making your own regular expression

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services