Skip to content

Commit 5f57186

Browse files
committed
Fixed all comments to follow the go standard
1 parent 252d91a commit 5f57186

File tree

8 files changed

+133
-133
lines changed

8 files changed

+133
-133
lines changed

examples/model/customer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (c *Customer) Valid() (bool, []validate.ValidationError) {
3030
_, errs := validate.IsValid(*c)
3131

3232
//
33-
//Customize: errs (you can add/remove your own errs)
33+
// Customize: errs (you can add/remove your own errs)
3434
//
3535

3636
// Showing use of a public validation method (extra validations outside of the struct built-in validations)

extra_validations.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ var (
4040

4141
// blacklistedDomains known blacklisted domains for email addresses
4242
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
4848
}
4949

5050
// acceptedCountryCodes is the countries this phone number validation can currently accept
@@ -63,7 +63,7 @@ const (
6363
// IsValidEnum validates an enum given the required parameters and tests if the supplied value is valid from accepted values
6464
func IsValidEnum(enum string, allowedValues *[]string, emptyValueAllowed bool) (success bool, err error) {
6565

66-
//Empty is true and no value given?
66+
// Empty is true and no value given?
6767
if emptyValueAllowed == true && len(enum) == 0 {
6868
success = true
6969
return
@@ -129,7 +129,7 @@ func IsValidEmail(email string, mxCheck bool) (success bool, err error) {
129129
return
130130
}
131131

132-
//Check for mx record or A record
132+
// Check for mx record or A record
133133
if mxCheck {
134134
if _, err = net.LookupMX(host); err != nil {
135135
if _, err = net.LookupIP(host); err != nil {
@@ -277,7 +277,7 @@ func IsValidPhoneNumber(phone string, countryCode string) (success bool, err err
277277
return
278278
}
279279

280-
case "52": //Mexico
280+
case "52": // Mexico
281281

282282
// Rules found so far: https://en.wikipedia.org/wiki/Telephone_numbers_in_Mexico
283283

@@ -286,7 +286,7 @@ func IsValidPhoneNumber(phone string, countryCode string) (success bool, err err
286286
firstDigitOfNpa := npa[0:1]
287287

288288
// 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
290290
err = fmt.Errorf("phone number must be either eight or ten digits")
291291
return
292292
}
@@ -297,7 +297,7 @@ func IsValidPhoneNumber(phone string, countryCode string) (success bool, err err
297297
return
298298
}
299299

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)
301301

302302
default:
303303
err = fmt.Errorf("country code %s is not accepted", countryCode)

0 commit comments

Comments
 (0)