diff --git a/_examples/struct-level/main.go b/_examples/struct-level/main.go index faba03fbb..a0cdf5436 100644 --- a/_examples/struct-level/main.go +++ b/_examples/struct-level/main.go @@ -156,7 +156,7 @@ func main() { } // UserStructLevelValidation contains custom struct level validations that don't always -// make sense at the field validation level. For Example this function validates that either +// make sense at the field validation level. For example, this function validates that either // FirstName or LastName exist; could have done that with a custom field validation but then // would have had to add it to both fields duplicating the logic + overhead, this way it's // only validated once. diff --git a/doc.go b/doc.go index 91bace77d..23cce9916 100644 --- a/doc.go +++ b/doc.go @@ -188,7 +188,7 @@ Same as structonly tag except that any struct level validations will not run. # Omit Empty -Allows conditional validation, for example if a field is not set with +Allows conditional validation, for example, if a field is not set with a value (Determined by the "required" validator) then other validation such as min or max won't run, but if a value is set validation will run. diff --git a/errors.go b/errors.go index 2b99d0e02..fd9062567 100644 --- a/errors.go +++ b/errors.go @@ -105,24 +105,24 @@ type FieldError interface { // StructNamespace returns the namespace for the field error, with the field's // actual name. // - // eq. "User.FirstName" see Namespace for comparison + // eg. "User.FirstName" see Namespace for comparison // // NOTE: this field can be blank when validating a single primitive field // using validate.Field(...) as there is no way to extract its name StructNamespace() string - // Field returns the fields name with the tag name taking precedence over the + // Field returns the field's name with the tag name taking precedence over the // field's actual name. // // `RegisterTagNameFunc` must be registered to get tag value. // - // eq. JSON name "fname" + // eg. JSON name "fname" // see StructField for comparison Field() string // StructField returns the field's actual name from the struct, when able to determine. // - // eq. "FirstName" + // eg. "FirstName" // see Field for comparison StructField() string diff --git a/util.go b/util.go index 869ecebdb..b1fd8cc11 100644 --- a/util.go +++ b/util.go @@ -217,7 +217,7 @@ BEGIN: panic("Invalid field namespace") } -// asInt returns the parameter as a int64 +// asInt returns the parameter as an int64 // or panics if it can't convert func asInt(param string) int64 { i, err := strconv.ParseInt(param, 0, 64)