Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,101 +2,51 @@ version: "2"
linters:
default: all
disable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
- cyclop
- decorder
- depguard
- dogsled
- dupl
- dupword
- durationcheck
- err113
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
- exhaustruct
- exptostd
- fatcontext
- forbidigo
- forcetypeassert
- funlen
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goheader
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosmopolitan
- govet
- grouper
- iface
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- ireturn
- lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
- nilerr
- nilnesserr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- paralleltest
- perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- tagalign
- tagliatelle
- testableexamples
- testifylint
- testpackage
- thelper
- tparallel
- unparam
- varnamelen
- whitespace
- wrapcheck
- wsl
- zerologlint
33 changes: 0 additions & 33 deletions baked_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,6 @@ func isNeField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return field.Int() != currentField.Int()

Expand All @@ -966,7 +965,6 @@ func isNeField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {

t := currentField.Interface().(time.Time)
fieldTime := field.Interface().(time.Time)

Expand Down Expand Up @@ -1005,7 +1003,6 @@ func isLteCrossStructField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return field.Int() <= topField.Int()

Expand All @@ -1023,7 +1020,6 @@ func isLteCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {

fieldTime := field.Convert(timeType).Interface().(time.Time)
topTime := topField.Convert(timeType).Interface().(time.Time)

Expand Down Expand Up @@ -1052,7 +1048,6 @@ func isLtCrossStructField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return field.Int() < topField.Int()

Expand All @@ -1070,7 +1065,6 @@ func isLtCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {

fieldTime := field.Convert(timeType).Interface().(time.Time)
topTime := topField.Convert(timeType).Interface().(time.Time)

Expand Down Expand Up @@ -1098,7 +1092,6 @@ func isGteCrossStructField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return field.Int() >= topField.Int()

Expand All @@ -1116,7 +1109,6 @@ func isGteCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {

fieldTime := field.Convert(timeType).Interface().(time.Time)
topTime := topField.Convert(timeType).Interface().(time.Time)

Expand Down Expand Up @@ -1144,7 +1136,6 @@ func isGtCrossStructField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return field.Int() > topField.Int()

Expand All @@ -1162,7 +1153,6 @@ func isGtCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {

fieldTime := field.Convert(timeType).Interface().(time.Time)
topTime := topField.Convert(timeType).Interface().(time.Time)

Expand Down Expand Up @@ -1190,7 +1180,6 @@ func isNeCrossStructField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return topField.Int() != field.Int()

Expand All @@ -1211,7 +1200,6 @@ func isNeCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {

t := field.Convert(timeType).Interface().(time.Time)
fieldTime := topField.Convert(timeType).Interface().(time.Time)

Expand Down Expand Up @@ -1239,7 +1227,6 @@ func isEqCrossStructField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return topField.Int() == field.Int()

Expand All @@ -1260,7 +1247,6 @@ func isEqCrossStructField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) {

t := field.Convert(timeType).Interface().(time.Time)
fieldTime := topField.Convert(timeType).Interface().(time.Time)

Expand Down Expand Up @@ -1288,7 +1274,6 @@ func isEqField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return field.Int() == currentField.Int()

Expand All @@ -1309,7 +1294,6 @@ func isEqField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {

t := currentField.Convert(timeType).Interface().(time.Time)
fieldTime := field.Convert(timeType).Interface().(time.Time)

Expand All @@ -1332,7 +1316,6 @@ func isEq(fl FieldLevel) bool {
param := fl.Param()

switch field.Kind() {

case reflect.String:
return field.String() == param

Expand Down Expand Up @@ -1851,7 +1834,6 @@ func requireCheckFieldValue(
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return field.Int() == asInt(value)

Expand Down Expand Up @@ -2060,7 +2042,6 @@ func isGteField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:

return field.Int() >= currentField.Int()
Expand All @@ -2078,7 +2059,6 @@ func isGteField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {

t := currentField.Convert(timeType).Interface().(time.Time)
fieldTime := field.Convert(timeType).Interface().(time.Time)

Expand Down Expand Up @@ -2106,7 +2086,6 @@ func isGtField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:

return field.Int() > currentField.Int()
Expand All @@ -2124,7 +2103,6 @@ func isGtField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {

t := currentField.Convert(timeType).Interface().(time.Time)
fieldTime := field.Convert(timeType).Interface().(time.Time)

Expand All @@ -2147,7 +2125,6 @@ func isGte(fl FieldLevel) bool {
param := fl.Param()

switch field.Kind() {

case reflect.String:
p := asInt(param)

Expand Down Expand Up @@ -2181,7 +2158,6 @@ func isGte(fl FieldLevel) bool {
case reflect.Struct:

if field.Type().ConvertibleTo(timeType) {

now := time.Now().UTC()
t := field.Convert(timeType).Interface().(time.Time)

Expand All @@ -2198,7 +2174,6 @@ func isGt(fl FieldLevel) bool {
param := fl.Param()

switch field.Kind() {

case reflect.String:
p := asInt(param)

Expand Down Expand Up @@ -2245,7 +2220,6 @@ func hasLengthOf(fl FieldLevel) bool {
param := fl.Param()

switch field.Kind() {

case reflect.String:
p := asInt(param)

Expand Down Expand Up @@ -2296,7 +2270,6 @@ func isLteField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:

return field.Int() <= currentField.Int()
Expand All @@ -2314,7 +2287,6 @@ func isLteField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {

t := currentField.Convert(timeType).Interface().(time.Time)
fieldTime := field.Convert(timeType).Interface().(time.Time)

Expand Down Expand Up @@ -2342,7 +2314,6 @@ func isLtField(fl FieldLevel) bool {
}

switch kind {

case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:

return field.Int() < currentField.Int()
Expand All @@ -2360,7 +2331,6 @@ func isLtField(fl FieldLevel) bool {
fieldType := field.Type()

if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) {

t := currentField.Convert(timeType).Interface().(time.Time)
fieldTime := field.Convert(timeType).Interface().(time.Time)

Expand All @@ -2383,7 +2353,6 @@ func isLte(fl FieldLevel) bool {
param := fl.Param()

switch field.Kind() {

case reflect.String:
p := asInt(param)

Expand Down Expand Up @@ -2417,7 +2386,6 @@ func isLte(fl FieldLevel) bool {
case reflect.Struct:

if field.Type().ConvertibleTo(timeType) {

now := time.Now().UTC()
t := field.Convert(timeType).Interface().(time.Time)

Expand All @@ -2434,7 +2402,6 @@ func isLt(fl FieldLevel) bool {
param := fl.Param()

switch field.Kind() {

case reflect.String:
p := asInt(param)

Expand Down
3 changes: 0 additions & 3 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ func (v *Validate) extractStructCache(current reflect.Value, sName string) *cStr
var customName string

for i := 0; i < numFields; i++ {

fld = typ.Field(i)

if !v.privateFieldValidation && !fld.Anonymous && len(fld.PkgPath) > 0 {
Expand Down Expand Up @@ -191,7 +190,6 @@ func (v *Validate) parseFieldTagsRecursive(tag string, fieldName string, alias s
} else {
next, curr := v.parseFieldTagsRecursive(tagsVal, fieldName, t, true)
current.next, current = next, curr

}
continue
}
Expand Down Expand Up @@ -225,7 +223,6 @@ func (v *Validate) parseFieldTagsRecursive(tag string, fieldName string, alias s
i++

for ; i < len(tags); i++ {

b = append(b, tags[i]...)
b = append(b, ',')

Expand Down
Loading