Skip to content

Commit 0df4e00

Browse files
authored
Fix grammar issues in comments, tests, field names (#1262)
## Fixes Or Enhances Typos and other grammar issues in comments, tests, and field names. @go-playground/validator-maintainers
1 parent 10c3c84 commit 0df4e00

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

_examples/translations/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ type Address struct {
2727
Phone string `validate:"required"`
2828
}
2929

30-
// use a single instance , it caches struct info
30+
// use a single instance, it caches struct info
3131
var (
3232
uni *ut.UniversalTranslator
3333
validate *validator.Validate
3434
)
3535

3636
func main() {
3737

38-
// NOTE: ommitting allot of error checking for brevity
38+
// NOTE: omitting allot of error checking for brevity
3939

4040
en := en.New()
4141
uni = ut.New(en, en)

baked_in.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ func isEthereumAddress(fl FieldLevel) bool {
691691
return ethAddressRegex.MatchString(address)
692692
}
693693

694-
// isEthereumAddressChecksum is the validation function for validating if the field's value is a valid checksumed Ethereum address.
694+
// isEthereumAddressChecksum is the validation function for validating if the field's value is a valid checksummed Ethereum address.
695695
func isEthereumAddressChecksum(fl FieldLevel) bool {
696696
address := fl.Field().String()
697697

cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func (v *Validate) parseFieldTagsRecursive(tag string, fieldName string, alias s
294294

295295
if wrapper, ok := v.validations[current.tag]; ok {
296296
current.fn = wrapper.fn
297-
current.runValidationWhenNil = wrapper.runValidatinOnNil
297+
current.runValidationWhenNil = wrapper.runValidationOnNil
298298
} else {
299299
panic(strings.TrimSpace(fmt.Sprintf(undefinedValidation, current.tag, fieldName)))
300300
}

doc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ This will accept any uri the golang request uri accepts
911911
912912
# Urn RFC 2141 String
913913
914-
This validataes that a string value contains a valid URN
914+
This validates that a string value contains a valid URN
915915
according to the RFC 2141 spec.
916916
917917
Usage: urn_rfc2141
@@ -966,7 +966,7 @@ Bitcoin Bech32 Address (segwit)
966966
967967
This validates that a string value contains a valid bitcoin Bech32 address as defined
968968
by bip-0173 (https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)
969-
Special thanks to Pieter Wuille for providng reference implementations.
969+
Special thanks to Pieter Wuille for providing reference implementations.
970970
971971
Usage: btc_addr_bech32
972972
@@ -1299,7 +1299,7 @@ may not exist at the time of validation.
12991299
# HostPort
13001300
13011301
This validates that a string value contains a valid DNS hostname and port that
1302-
can be used to valiate fields typically passed to sockets and connections.
1302+
can be used to validate fields typically passed to sockets and connections.
13031303
13041304
Usage: hostname_port
13051305

validator_instance.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ type CustomTypeFunc func(field reflect.Value) interface{}
7474
type TagNameFunc func(field reflect.StructField) string
7575

7676
type internalValidationFuncWrapper struct {
77-
fn FuncCtx
78-
runValidatinOnNil bool
77+
fn FuncCtx
78+
runValidationOnNil bool
7979
}
8080

8181
// Validate contains the validator settings and cache
@@ -245,7 +245,7 @@ func (v *Validate) registerValidation(tag string, fn FuncCtx, bakedIn bool, nilC
245245
if !bakedIn && (ok || strings.ContainsAny(tag, restrictedTagChars)) {
246246
panic(fmt.Sprintf(restrictedTagErr, tag))
247247
}
248-
v.validations[tag] = internalValidationFuncWrapper{fn: fn, runValidatinOnNil: nilCheckable}
248+
v.validations[tag] = internalValidationFuncWrapper{fn: fn, runValidationOnNil: nilCheckable}
249249
return nil
250250
}
251251

@@ -676,7 +676,7 @@ func (v *Validate) VarWithValue(field interface{}, other interface{}, tag string
676676
}
677677

678678
// VarWithValueCtx validates a single variable, against another variable/field's value using tag style validation and
679-
// allows passing of contextual validation validation information via context.Context.
679+
// allows passing of contextual validation information via context.Context.
680680
// eg.
681681
// s1 := "abcd"
682682
// s2 := "abcd"

validator_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727

2828
// NOTES:
2929
// - Run "go test" to run tests
30-
// - Run "gocov test | gocov report" to report on test converage by file
31-
// - Run "gocov test | gocov annotate -" to report on all code and functions, those ,marked with "MISS" were never called
30+
// - Run "gocov test | gocov report" to report on test coverage by file
31+
// - Run "gocov test | gocov annotate -" to report on all code and functions, those, marked with "MISS" were never called
3232
//
3333
// or
3434
//
@@ -799,7 +799,7 @@ func TestStructPartial(t *testing.T) {
799799
errs = validate.StructPartial(tPartial, p2...)
800800
Equal(t, errs, nil)
801801

802-
// this isn't really a robust test, but is ment to illustrate the ANON CASE below
802+
// this isn't really a robust test, but is meant to illustrate the ANON CASE below
803803
errs = validate.StructPartial(tPartial.SubSlice[0], p3...)
804804
Equal(t, errs, nil)
805805

@@ -809,7 +809,7 @@ func TestStructPartial(t *testing.T) {
809809
errs = validate.StructExcept(tPartial, p2...)
810810
Equal(t, errs, nil)
811811

812-
// mod tParial for required feild and re-test making sure invalid fields are NOT required:
812+
// mod tPartial for required field and re-test making sure invalid fields are NOT required:
813813
tPartial.Required = ""
814814

815815
errs = validate.StructExcept(tPartial, p1...)
@@ -830,7 +830,7 @@ func TestStructPartial(t *testing.T) {
830830
tPartial.Required = "Required"
831831
tPartial.Anonymous.A = ""
832832

833-
// will pass as unset feilds is not going to be tested
833+
// will pass as unset fields is not going to be tested
834834
errs = validate.StructPartial(tPartial, p1...)
835835
Equal(t, errs, nil)
836836

@@ -841,7 +841,7 @@ func TestStructPartial(t *testing.T) {
841841
errs = validate.StructExcept(tPartial.Anonymous, p4...)
842842
Equal(t, errs, nil)
843843

844-
// will fail as unset feild is tested
844+
// will fail as unset field is tested
845845
errs = validate.StructPartial(tPartial, p2...)
846846
NotEqual(t, errs, nil)
847847
AssertError(t, errs, "TestPartial.Anonymous.A", "TestPartial.Anonymous.A", "A", "A", "required")
@@ -893,7 +893,7 @@ func TestStructPartial(t *testing.T) {
893893
Equal(t, len(errs.(ValidationErrors)), 1)
894894
AssertError(t, errs, "TestPartial.SubSlice[0].Test", "TestPartial.SubSlice[0].Test", "Test", "Test", "required")
895895

896-
// reset struct in slice, and unset struct in slice in unset posistion
896+
// reset struct in slice, and unset struct in slice in unset position
897897
tPartial.SubSlice[0].Test = "Required"
898898

899899
// these will pass as the unset item is NOT tested
@@ -9268,7 +9268,7 @@ func TestCustomFieldName(t *testing.T) {
92689268
Equal(t, getError(errs, "A.E", "A.E").Field(), "E")
92699269
}
92709270

9271-
func TestMutipleRecursiveExtractStructCache(t *testing.T) {
9271+
func TestMultipleRecursiveExtractStructCache(t *testing.T) {
92729272
validate := New()
92739273

92749274
type Recursive struct {
@@ -9609,7 +9609,7 @@ func TestStructFiltered(t *testing.T) {
96099609
errs = validate.StructFiltered(tPartial.SubSlice[0], p3)
96109610
Equal(t, errs, nil)
96119611

9612-
// mod tParial for required field and re-test making sure invalid fields are NOT required:
9612+
// mod tPartial for required field and re-test making sure invalid fields are NOT required:
96139613
tPartial.Required = ""
96149614

96159615
// inversion and retesting Partial to generate failures:
@@ -9621,7 +9621,7 @@ func TestStructFiltered(t *testing.T) {
96219621
tPartial.Required = "Required"
96229622
tPartial.Anonymous.A = ""
96239623

9624-
// will pass as unset feilds is not going to be tested
9624+
// will pass as unset fields is not going to be tested
96259625
errs = validate.StructFiltered(tPartial, p1)
96269626
Equal(t, errs, nil)
96279627

@@ -10558,7 +10558,7 @@ func TestHTMLEncodedValidation(t *testing.T) {
1055810558
}
1055910559
} else {
1056010560
if IsEqual(errs, nil) {
10561-
t.Fatalf("Index: %d html_enocded failed Error: %v", i, errs)
10561+
t.Fatalf("Index: %d html_encoded failed Error: %v", i, errs)
1056210562
} else {
1056310563
val := getError(errs, "", "")
1056410564
if val.Tag() != "html_encoded" {
@@ -10599,7 +10599,7 @@ func TestURLEncodedValidation(t *testing.T) {
1059910599
}
1060010600
} else {
1060110601
if IsEqual(errs, nil) {
10602-
t.Fatalf("Index: %d url_enocded failed Error: %v", i, errs)
10602+
t.Fatalf("Index: %d url_encoded failed Error: %v", i, errs)
1060310603
} else {
1060410604
val := getError(errs, "", "")
1060510605
if val.Tag() != "url_encoded" {

0 commit comments

Comments
 (0)