Skip to content

Commit e6fb514

Browse files
authored
Fix typos and remove duplicated words in comments (#1100)
1 parent ba7d9ec commit e6fb514

6 files changed

+18
-18
lines changed

baked_in.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Func func(fl FieldLevel) bool
3333
// validation needs. The return value should be true when validation succeeds.
3434
type FuncCtx func(ctx context.Context, fl FieldLevel) bool
3535

36-
// wrapFunc wraps noramal Func makes it compatible with FuncCtx
36+
// wrapFunc wraps normal Func makes it compatible with FuncCtx
3737
func wrapFunc(fn Func) FuncCtx {
3838
if fn == nil {
3939
return nil // be sure not to wrap a bad function.

doc.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ use the UTF-8 hex representation 0x7C, which is replaced in the code as a pipe,
146146
so the above will become excludesall=0x7C
147147
148148
type Test struct {
149-
Field `validate:"excludesall=|"` // BAD! Do not include a a pipe!
149+
Field `validate:"excludesall=|"` // BAD! Do not include a pipe!
150150
Field `validate:"excludesall=0x7C"` // GOOD! Use the UTF-8 hex representation.
151151
}
152152
@@ -239,7 +239,7 @@ Example #2
239239
240240
map[[2]string]string with validation tag "gt=0,dive,keys,dive,eq=1|eq=2,endkeys,required"
241241
// gt=0 will be applied to the map itself
242-
// eq=1|eq=2 will be applied to each array element in the the map keys
242+
// eq=1|eq=2 will be applied to each array element in the map keys
243243
// required will be applied to map values
244244
245245
# Required
@@ -916,7 +916,7 @@ this with the omitempty tag.
916916
# Base64URL String
917917
918918
This validates that a string value contains a valid base64 URL safe value
919-
according the the RFC4648 spec.
919+
according the RFC4648 spec.
920920
Although an empty string is a valid base64 URL safe value, this will report
921921
an empty string as an error, if you wish to accept an empty string as valid
922922
you can use this with the omitempty tag.
@@ -927,7 +927,7 @@ you can use this with the omitempty tag.
927927
# Base64RawURL String
928928
929929
This validates that a string value contains a valid base64 URL safe value,
930-
but without = padding, according the the RFC4648 spec, section 3.2.
930+
but without = padding, according the RFC4648 spec, section 3.2.
931931
Although an empty string is a valid base64 URL safe value, this will report
932932
an empty string as an error, if you wish to accept an empty string as valid
933933
you can use this with the omitempty tag.
@@ -1361,7 +1361,7 @@ More information on https://cve.mitre.org/
13611361
13621362
# Credit Card
13631363
1364-
This validates that a string value contains a valid credit card number using Luhn algoritm.
1364+
This validates that a string value contains a valid credit card number using Luhn algorithm.
13651365
13661366
Usage: credit_card
13671367

struct_level.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type StructLevel interface {
6262
// existing namespace that validator is on.
6363
// e.g. pass 'User.FirstName' or 'Users[0].FirstName' depending
6464
// on the nesting. most of the time they will be blank, unless you validate
65-
// at a level lower the the current field depth
65+
// at a level lower the current field depth
6666
ReportValidationErrors(relativeNamespace, relativeActualNamespace string, errs ValidationErrors)
6767
}
6868

@@ -74,7 +74,7 @@ var _ StructLevel = new(validate)
7474
// if not is a nested struct.
7575
//
7676
// this is only called when within Struct and Field Level validation and
77-
// should not be relied upon for an acurate value otherwise.
77+
// should not be relied upon for an accurate value otherwise.
7878
func (v *validate) Top() reflect.Value {
7979
return v.top
8080
}
@@ -85,7 +85,7 @@ func (v *validate) Top() reflect.Value {
8585
// if not is a nested struct.
8686
//
8787
// this is only called when within Struct and Field Level validation and
88-
// should not be relied upon for an acurate value otherwise.
88+
// should not be relied upon for an accurate value otherwise.
8989
func (v *validate) Parent() reflect.Value {
9090
return v.slflParent
9191
}

util.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func asInt(param string) int64 {
234234
func asIntFromTimeDuration(param string) int64 {
235235
d, err := time.ParseDuration(param)
236236
if err != nil {
237-
// attempt parsing as an an integer assuming nanosecond precision
237+
// attempt parsing as an integer assuming nanosecond precision
238238
return asInt(param)
239239
}
240240
return int64(d)

validator_instance.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var (
5858

5959
// FilterFunc is the type used to filter fields using
6060
// StructFiltered(...) function.
61-
// returning true results in the field being filtered/skiped from
61+
// returning true results in the field being filtered/skipped from
6262
// validation
6363
type FilterFunc func(ns []byte) bool
6464

@@ -153,7 +153,7 @@ func (v *Validate) SetTagName(name string) {
153153
}
154154

155155
// ValidateMapCtx validates a map using a map of validation rules and allows passing of contextual
156-
// validation validation information via context.Context.
156+
// validation information via context.Context.
157157
func (v Validate) ValidateMapCtx(ctx context.Context, data map[string]interface{}, rules map[string]interface{}) map[string]interface{} {
158158
errs := make(map[string]interface{})
159159
for field, rule := range rules {
@@ -453,7 +453,7 @@ func (v *Validate) StructPartial(s interface{}, fields ...string) error {
453453
}
454454

455455
// StructPartialCtx validates the fields passed in only, ignoring all others and allows passing of contextual
456-
// validation validation information via context.Context
456+
// validation information via context.Context
457457
// Fields may be provided in a namespaced fashion relative to the struct provided
458458
// eg. NestedStruct.Field or NestedArrayField[0].Struct.Name
459459
//
@@ -543,7 +543,7 @@ func (v *Validate) StructExcept(s interface{}, fields ...string) error {
543543
}
544544

545545
// StructExceptCtx validates all fields except the ones passed in and allows passing of contextual
546-
// validation validation information via context.Context
546+
// validation information via context.Context
547547
// Fields may be provided in a namespaced fashion relative to the struct provided
548548
// i.e. NestedStruct.Field or NestedArrayField[0].Struct.Name
549549
//

validator_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -9319,11 +9319,11 @@ func TestStructFiltered(t *testing.T) {
93199319
errs = validate.StructFiltered(tPartial, p2)
93209320
Equal(t, errs, nil)
93219321

9322-
// this isn't really a robust test, but is ment to illustrate the ANON CASE below
9322+
// this isn't really a robust test, but is meant to illustrate the ANON CASE below
93239323
errs = validate.StructFiltered(tPartial.SubSlice[0], p3)
93249324
Equal(t, errs, nil)
93259325

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

93299329
// inversion and retesting Partial to generate failures:
@@ -9339,7 +9339,7 @@ func TestStructFiltered(t *testing.T) {
93399339
errs = validate.StructFiltered(tPartial, p1)
93409340
Equal(t, errs, nil)
93419341

9342-
// will fail as unset feild is tested
9342+
// will fail as unset field is tested
93439343
errs = validate.StructFiltered(tPartial, p2)
93449344
NotEqual(t, errs, nil)
93459345
AssertError(t, errs, "TestPartial.Anonymous.A", "TestPartial.Anonymous.A", "A", "A", "required")
@@ -9368,7 +9368,7 @@ func TestStructFiltered(t *testing.T) {
93689368
Equal(t, len(errs.(ValidationErrors)), 1)
93699369
AssertError(t, errs, "TestPartial.SubSlice[0].Test", "TestPartial.SubSlice[0].Test", "Test", "Test", "required")
93709370

9371-
// reset struct in slice, and unset struct in slice in unset posistion
9371+
// reset struct in slice, and unset struct in slice in unset position
93729372
tPartial.SubSlice[0].Test = "Required"
93739373

93749374
// these will pass as the unset item is NOT tested

0 commit comments

Comments
 (0)