@@ -40,11 +40,11 @@ var (
40
40
41
41
// blacklistedDomains known blacklisted domains for email addresses
42
42
blacklistedDomains = []string {
43
- "aol.con" , //Does not exist, but valid TLD in regex
44
- "example.com" , //Invalid domain - used for testing but should not work in production
45
- "gmail.con" , //Does not exist, but valid TLD in regex
46
- "hotmail.con" , //Does not exist, but valid TLD in regex
47
- "yahoo.con" , //Does not exist, but valid TLD in regex
43
+ "aol.con" , // Does not exist, but valid TLD in regex
44
+ "example.com" , // Invalid domain - used for testing but should not work in production
45
+ "gmail.con" , // Does not exist, but valid TLD in regex
46
+ "hotmail.con" , // Does not exist, but valid TLD in regex
47
+ "yahoo.con" , // Does not exist, but valid TLD in regex
48
48
}
49
49
50
50
// acceptedCountryCodes is the countries this phone number validation can currently accept
@@ -63,7 +63,7 @@ const (
63
63
// IsValidEnum validates an enum given the required parameters and tests if the supplied value is valid from accepted values
64
64
func IsValidEnum (enum string , allowedValues * []string , emptyValueAllowed bool ) (success bool , err error ) {
65
65
66
- //Empty is true and no value given?
66
+ // Empty is true and no value given?
67
67
if emptyValueAllowed == true && len (enum ) == 0 {
68
68
success = true
69
69
return
@@ -129,7 +129,7 @@ func IsValidEmail(email string, mxCheck bool) (success bool, err error) {
129
129
return
130
130
}
131
131
132
- //Check for mx record or A record
132
+ // Check for mx record or A record
133
133
if mxCheck {
134
134
if _ , err = net .LookupMX (host ); err != nil {
135
135
if _ , err = net .LookupIP (host ); err != nil {
@@ -277,7 +277,7 @@ func IsValidPhoneNumber(phone string, countryCode string) (success bool, err err
277
277
return
278
278
}
279
279
280
- case "52" : //Mexico
280
+ case "52" : // Mexico
281
281
282
282
// Rules found so far: https://en.wikipedia.org/wiki/Telephone_numbers_in_Mexico
283
283
@@ -286,7 +286,7 @@ func IsValidPhoneNumber(phone string, countryCode string) (success bool, err err
286
286
firstDigitOfNpa := npa [0 :1 ]
287
287
288
288
// Validate the proper length
289
- if len (phone ) != 8 && len (phone ) != 10 { //2002 mexico had 8 digit numbers and went to 10 digits
289
+ if len (phone ) != 8 && len (phone ) != 10 { // 2002 mexico had 8 digit numbers and went to 10 digits
290
290
err = fmt .Errorf ("phone number must be either eight or ten digits" )
291
291
return
292
292
}
@@ -297,7 +297,7 @@ func IsValidPhoneNumber(phone string, countryCode string) (success bool, err err
297
297
return
298
298
}
299
299
300
- //todo: validate MX number following Mexico's phone number system (not sure if there are more requirements) (@mrz)
300
+ // todo: validate MX number following Mexico's phone number system (not sure if there are more requirements) (@mrz)
301
301
302
302
default :
303
303
err = fmt .Errorf ("country code %s is not accepted" , countryCode )
0 commit comments