diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 9f6c995..c99a682 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -20,7 +20,7 @@ community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +* Accepting responsibility and apologizing to those affected by our errors, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community diff --git a/README.md b/README.md index 78360bc..8fe9c09 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,9 @@ type Person struct { person := &Person{} -mistakes, valid := checker.Check(person) +errors, valid := checker.Check(person) if !valid { - // Send the mistakes back to the user + // Send the errors back to the user } ``` @@ -333,7 +333,7 @@ import ( func main() { err := checker.IsASCII("Checker") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -365,7 +365,7 @@ import ( func main() { err := checker.IsAlphanumeric("ABcd1234") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -398,7 +398,7 @@ func main() { err := checker.IsAmexCreditCard("378282246310005") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -431,7 +431,7 @@ func main() { err := checker.IsAnyCreditCard("6011111111111117") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -463,7 +463,7 @@ import ( func main() { err := checker.IsCidr("2001:db8::/32") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -495,7 +495,7 @@ import ( func main() { err := checker.IsDigits("1234") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -528,7 +528,7 @@ func main() { err := checker.IsDinersCreditCard("36227206271667") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -561,7 +561,7 @@ func main() { err := checker.IsDiscoverCreditCard("6011111111111117") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -593,7 +593,7 @@ import ( func main() { err := checker.IsEmail("user@zdo.com") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -625,7 +625,7 @@ import ( func main() { err := checker.IsFqdn("zdo.com") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -657,7 +657,7 @@ import ( func main() { err := checker.IsIP("2001:db8::68") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -689,7 +689,7 @@ import ( func main() { err := checker.IsIPV4("192.168.1.1") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -722,7 +722,7 @@ func main() { err := checker.IsIPV6("2001:db8::68") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -754,7 +754,7 @@ import ( func main() { err := checker.IsISBN("1430248270") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -786,7 +786,7 @@ import ( func main() { err := checker.IsISBN10("1430248270") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -818,7 +818,7 @@ import ( func main() { err := checker.IsISBN13("9781430248279") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -851,7 +851,7 @@ func main() { err := checker.IsJcbCreditCard("3530111333300000") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -883,7 +883,7 @@ import ( func main() { err := checker.IsLuhn("4012888888881881") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -915,7 +915,7 @@ import ( func main() { err := checker.IsMac("00:00:5e:00:53:01") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -948,7 +948,7 @@ func main() { err := checker.IsMasterCardCreditCard("5555555555554444") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -982,7 +982,7 @@ func main() { err := checker.IsMax(quantity, 10) if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -1016,7 +1016,7 @@ func main() { err := checker.IsMaxLength(s, 4) if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -1050,7 +1050,7 @@ func main() { err := checker.IsMin(age, 21) if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -1084,7 +1084,7 @@ func main() { err := checker.IsMinLength(s, 4) if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -1150,7 +1150,7 @@ import ( func main() { err := checker.IsURL("https://zdo.com") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -1183,7 +1183,7 @@ func main() { err := checker.IsUnionPayCreditCard("6200000000000005") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` @@ -1216,7 +1216,7 @@ func main() { err := checker.IsVisaCreditCard("4111111111111111") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } ``` diff --git a/alphanumeric_test.go b/alphanumeric_test.go index 4fe9661..e94768c 100644 --- a/alphanumeric_test.go +++ b/alphanumeric_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsAlphanumeric() { err := checker.IsAlphanumeric("ABcd1234") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/ascii_test.go b/ascii_test.go index 8685362..238f60b 100644 --- a/ascii_test.go +++ b/ascii_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsASCII() { err := checker.IsASCII("Checker") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/checker.go b/checker.go index 595649c..b5ef498 100644 --- a/checker.go +++ b/checker.go @@ -75,7 +75,7 @@ func Check(s interface{}) (Errors, bool) { panic("expecting struct") } - errors := Errors{} + errs := Errors{} jobs := []checkerJob{ { @@ -118,14 +118,14 @@ func Check(s interface{}) (Errors, bool) { } else { for _, checker := range initCheckers(job.Config) { if err := checker(job.Value, job.Parent); err != nil { - errors[job.Name] = err + errs[job.Name] = err break } } } } - return errors, len(errors) == 0 + return errs, len(errs) == 0 } // initCheckers initializes the checkers provided in the config. diff --git a/checker_test.go b/checker_test.go index 723a9e6..540bca5 100644 --- a/checker_test.go +++ b/checker_test.go @@ -60,16 +60,16 @@ func TestCheckInvalid(t *testing.T) { person := &Person{} - mistakes, valid := Check(person) + errors, valid := Check(person) if valid { t.Fail() } - if len(mistakes) != 1 { + if len(errors) != 1 { t.Fail() } - if mistakes["Name"] != ErrRequired { + if errors["Name"] != ErrRequired { t.Fail() } } @@ -83,12 +83,12 @@ func TestCheckValid(t *testing.T) { Name: "Onur", } - mistakes, valid := Check(person) + errors, valid := Check(person) if !valid { t.Fail() } - if len(mistakes) != 0 { + if len(errors) != 0 { t.Fail() } } @@ -112,20 +112,20 @@ func TestCheckNestedStruct(t *testing.T) { person := &Person{} - mistakes, valid := Check(person) + errors, valid := Check(person) if valid { t.Fail() } - if len(mistakes) != 2 { + if len(errors) != 2 { t.Fail() } - if mistakes["Name"] != ErrRequired { + if errors["Name"] != ErrRequired { t.Fail() } - if mistakes["Home.Street"] != ErrRequired { + if errors["Home.Street"] != ErrRequired { t.Fail() } } diff --git a/cidr_test.go b/cidr_test.go index 2dd1e38..2d7852d 100644 --- a/cidr_test.go +++ b/cidr_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsCidr() { err := checker.IsCidr("2001:db8::/32") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/credit_card_test.go b/credit_card_test.go index f1905e8..fc81997 100644 --- a/credit_card_test.go +++ b/credit_card_test.go @@ -38,7 +38,7 @@ func ExampleIsAnyCreditCard() { err := checker.IsAnyCreditCard("6011111111111117") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } @@ -64,7 +64,7 @@ func ExampleIsAmexCreditCard() { err := checker.IsAmexCreditCard("378282246310005") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } @@ -90,7 +90,7 @@ func ExampleIsDinersCreditCard() { err := checker.IsDinersCreditCard("36227206271667") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } func TestIsDinersCreditCardValid(t *testing.T) { @@ -115,7 +115,7 @@ func ExampleIsDiscoverCreditCard() { err := checker.IsDiscoverCreditCard("6011111111111117") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } func TestIsDiscoverCreditCardValid(t *testing.T) { @@ -140,7 +140,7 @@ func ExampleIsJcbCreditCard() { err := checker.IsJcbCreditCard("3530111333300000") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } @@ -166,7 +166,7 @@ func ExampleIsMasterCardCreditCard() { err := checker.IsMasterCardCreditCard("5555555555554444") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } @@ -192,7 +192,7 @@ func ExampleIsUnionPayCreditCard() { err := checker.IsUnionPayCreditCard("6200000000000005") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } @@ -218,7 +218,7 @@ func ExampleIsVisaCreditCard() { err := checker.IsVisaCreditCard("4111111111111111") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } func TestIsVisaCreditCardValid(t *testing.T) { diff --git a/digits_test.go b/digits_test.go index 86830c1..4246713 100644 --- a/digits_test.go +++ b/digits_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsDigits() { err := checker.IsDigits("1234") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/email_test.go b/email_test.go index 862e2ef..c200ed0 100644 --- a/email_test.go +++ b/email_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsEmail() { err := checker.IsEmail("user@zdo.com") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/fqdn_test.go b/fqdn_test.go index 82edbfd..0a8d76e 100644 --- a/fqdn_test.go +++ b/fqdn_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsFqdn() { err := checker.IsFqdn("zdo.com") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/ip_test.go b/ip_test.go index 4995d8f..a9dd74d 100644 --- a/ip_test.go +++ b/ip_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsIP() { err := checker.IsIP("2001:db8::68") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/ipv4_test.go b/ipv4_test.go index fba513d..1e2509c 100644 --- a/ipv4_test.go +++ b/ipv4_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsIPV4() { err := checker.IsIPV4("192.168.1.1") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/ipv6_test.go b/ipv6_test.go index c8d8d4e..97be750 100644 --- a/ipv6_test.go +++ b/ipv6_test.go @@ -15,7 +15,7 @@ func ExampleIsIPV6() { err := checker.IsIPV6("2001:db8::68") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/isbn_test.go b/isbn_test.go index f173981..8d12e60 100644 --- a/isbn_test.go +++ b/isbn_test.go @@ -15,7 +15,7 @@ import ( func ExampleIsISBN10() { err := checker.IsISBN10("1430248270") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } @@ -57,7 +57,7 @@ func TestIsISBN10InvalidCheck(t *testing.T) { func ExampleIsISBN13() { err := checker.IsISBN13("9781430248279") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } @@ -92,7 +92,7 @@ func TestIsISBN13InvalidCheck(t *testing.T) { func ExampleIsISBN() { err := checker.IsISBN("1430248270") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/luhn_test.go b/luhn_test.go index e193621..3ddb5e1 100644 --- a/luhn_test.go +++ b/luhn_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsLuhn() { err := checker.IsLuhn("4012888888881881") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/mac_test.go b/mac_test.go index e966765..7e8ba63 100644 --- a/mac_test.go +++ b/mac_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsMac() { err := checker.IsMac("00:00:5e:00:53:01") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/max_test.go b/max_test.go index c6f3adf..6f5ce65 100644 --- a/max_test.go +++ b/max_test.go @@ -16,7 +16,7 @@ func ExampleIsMax() { err := checker.IsMax(quantity, 10) if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/maxlength_test.go b/maxlength_test.go index e2e6d3b..cb9b395 100644 --- a/maxlength_test.go +++ b/maxlength_test.go @@ -16,7 +16,7 @@ func ExampleIsMaxLength() { err := checker.IsMaxLength(s, 4) if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/min_test.go b/min_test.go index 40efbe7..dc12888 100644 --- a/min_test.go +++ b/min_test.go @@ -16,7 +16,7 @@ func ExampleIsMin() { err := checker.IsMin(age, 21) if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/minlength_test.go b/minlength_test.go index 045e958..bac0898 100644 --- a/minlength_test.go +++ b/minlength_test.go @@ -16,7 +16,7 @@ func ExampleIsMinLength() { err := checker.IsMinLength(s, 4) if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } } diff --git a/url_test.go b/url_test.go index 883eb0a..ed5334e 100644 --- a/url_test.go +++ b/url_test.go @@ -14,7 +14,7 @@ import ( func ExampleIsURL() { err := checker.IsURL("https://zdo.com") if err != nil { - // Send the mistakes back to the user + // Send the errors back to the user } }