// DomainName checks if the given string is a valid domain name and returns an error if not.
DomainName checks if the given string is a valid domain name and returns an error if not.
// DomainName checks if the given string is a valid domain name and returns an error if not .
func DomainName(v string) error {
	if err := nonEmpty(v); err != nil {
		return err
	}
	split := strings.Split(v, ".")
	for i, segment := range split {
		if len(segment) == 0 && i == len(split)-1 {
			continue
		}
		if !isMatch("^[a-zA-Z0-9-]{1,63}$", segment) {
			return errors.New("invalid domain name")
		}
	}
	return nil
}
func DomainName ( v string ) error { if err := nonEmpty ( v ) ; err != nil { return err } split := strings . Split ( v , " " ) for i , segment := range split { if len ( segment ) == 0 && i == len ( split ) - 1 { continue } if ! isMatch ( " " , segment ) { return errors . New ( " " ) } } return nil }
DomainName checks if the given string is a valid domain name and returns an error if not.
DomainName checks if the given string is a valid domain name and returns an error if not .
// Trailing dot is OK