Go critic identified issues. Fixes #82 (#87)

This commit is contained in:
Onur Cinar 2023-06-21 18:26:43 -07:00 committed by GitHub
commit db8ce0e625
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -16,7 +16,7 @@ const ResultNotEmail = "NOT_EMAIL"
const ipV6Prefix = "[IPv6:"
// notQuotedChars is the valid not quoted characters.
var notQuotedChars = regexp.MustCompile("[a-zA-Z0-9!#$%&'*+-/=?^_`{|}~]")
var notQuotedChars = regexp.MustCompile("[a-zA-Z0-9!#$%&'*\\+\\-/=?^_`{|}~]")
// IsEmail checks if the given string is an email address.
func IsEmail(email string) Result {
@ -33,7 +33,7 @@ func IsEmail(email string) Result {
user := email[:atIndex]
// Cannot be empty user
if len(user) == 0 || len(user) > 64 {
if user == "" || len(user) > 64 {
return ResultNotEmail
}

View file

@ -13,7 +13,7 @@ const CheckerFqdn = "fqdn"
const ResultNotFqdn = "NOT_FQDN"
// Valid characters excluding full-width characters.
var fqdnValidChars = regexp.MustCompile("^[a-z0-9\u00a1-\uff00\uff06-\uffff-]+$")
var fqdnValidChars = regexp.MustCompile("^[a-z0-9\u00a1-\uff00\uff06-\uffff\\-]+$")
// IsFqdn checks if the given string is a fully qualified domain name.
func IsFqdn(domain string) Result {