@@ -261,7 +261,7 @@ func parseOneOfParam2(s string) []string {
261261 oneofValsCacheRWLock .Lock ()
262262 vals = splitParamsRegex ().FindAllString (s , - 1 )
263263 for i := 0 ; i < len (vals ); i ++ {
264- vals [i ] = strings .Replace (vals [i ], "'" , "" , - 1 )
264+ vals [i ] = strings .ReplaceAll (vals [i ], "'" , "" )
265265 }
266266 oneofValsCache [s ] = vals
267267 oneofValsCacheRWLock .Unlock ()
@@ -946,7 +946,6 @@ func isNeField(fl FieldLevel) bool {
946946 }
947947
948948 switch kind {
949-
950949 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
951950 return field .Int () != currentField .Int ()
952951
@@ -967,7 +966,6 @@ func isNeField(fl FieldLevel) bool {
967966 fieldType := field .Type ()
968967
969968 if fieldType .ConvertibleTo (timeType ) && currentField .Type ().ConvertibleTo (timeType ) {
970-
971969 t := currentField .Interface ().(time.Time )
972970 fieldTime := field .Interface ().(time.Time )
973971
@@ -1006,7 +1004,6 @@ func isLteCrossStructField(fl FieldLevel) bool {
10061004 }
10071005
10081006 switch kind {
1009-
10101007 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
10111008 return field .Int () <= topField .Int ()
10121009
@@ -1024,7 +1021,6 @@ func isLteCrossStructField(fl FieldLevel) bool {
10241021 fieldType := field .Type ()
10251022
10261023 if fieldType .ConvertibleTo (timeType ) && topField .Type ().ConvertibleTo (timeType ) {
1027-
10281024 fieldTime := field .Convert (timeType ).Interface ().(time.Time )
10291025 topTime := topField .Convert (timeType ).Interface ().(time.Time )
10301026
@@ -1053,7 +1049,6 @@ func isLtCrossStructField(fl FieldLevel) bool {
10531049 }
10541050
10551051 switch kind {
1056-
10571052 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
10581053 return field .Int () < topField .Int ()
10591054
@@ -1071,7 +1066,6 @@ func isLtCrossStructField(fl FieldLevel) bool {
10711066 fieldType := field .Type ()
10721067
10731068 if fieldType .ConvertibleTo (timeType ) && topField .Type ().ConvertibleTo (timeType ) {
1074-
10751069 fieldTime := field .Convert (timeType ).Interface ().(time.Time )
10761070 topTime := topField .Convert (timeType ).Interface ().(time.Time )
10771071
@@ -1099,7 +1093,6 @@ func isGteCrossStructField(fl FieldLevel) bool {
10991093 }
11001094
11011095 switch kind {
1102-
11031096 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
11041097 return field .Int () >= topField .Int ()
11051098
@@ -1117,7 +1110,6 @@ func isGteCrossStructField(fl FieldLevel) bool {
11171110 fieldType := field .Type ()
11181111
11191112 if fieldType .ConvertibleTo (timeType ) && topField .Type ().ConvertibleTo (timeType ) {
1120-
11211113 fieldTime := field .Convert (timeType ).Interface ().(time.Time )
11221114 topTime := topField .Convert (timeType ).Interface ().(time.Time )
11231115
@@ -1145,7 +1137,6 @@ func isGtCrossStructField(fl FieldLevel) bool {
11451137 }
11461138
11471139 switch kind {
1148-
11491140 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
11501141 return field .Int () > topField .Int ()
11511142
@@ -1163,7 +1154,6 @@ func isGtCrossStructField(fl FieldLevel) bool {
11631154 fieldType := field .Type ()
11641155
11651156 if fieldType .ConvertibleTo (timeType ) && topField .Type ().ConvertibleTo (timeType ) {
1166-
11671157 fieldTime := field .Convert (timeType ).Interface ().(time.Time )
11681158 topTime := topField .Convert (timeType ).Interface ().(time.Time )
11691159
@@ -1191,7 +1181,6 @@ func isNeCrossStructField(fl FieldLevel) bool {
11911181 }
11921182
11931183 switch kind {
1194-
11951184 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
11961185 return topField .Int () != field .Int ()
11971186
@@ -1212,7 +1201,6 @@ func isNeCrossStructField(fl FieldLevel) bool {
12121201 fieldType := field .Type ()
12131202
12141203 if fieldType .ConvertibleTo (timeType ) && topField .Type ().ConvertibleTo (timeType ) {
1215-
12161204 t := field .Convert (timeType ).Interface ().(time.Time )
12171205 fieldTime := topField .Convert (timeType ).Interface ().(time.Time )
12181206
@@ -1240,7 +1228,6 @@ func isEqCrossStructField(fl FieldLevel) bool {
12401228 }
12411229
12421230 switch kind {
1243-
12441231 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
12451232 return topField .Int () == field .Int ()
12461233
@@ -1261,7 +1248,6 @@ func isEqCrossStructField(fl FieldLevel) bool {
12611248 fieldType := field .Type ()
12621249
12631250 if fieldType .ConvertibleTo (timeType ) && topField .Type ().ConvertibleTo (timeType ) {
1264-
12651251 t := field .Convert (timeType ).Interface ().(time.Time )
12661252 fieldTime := topField .Convert (timeType ).Interface ().(time.Time )
12671253
@@ -1289,7 +1275,6 @@ func isEqField(fl FieldLevel) bool {
12891275 }
12901276
12911277 switch kind {
1292-
12931278 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
12941279 return field .Int () == currentField .Int ()
12951280
@@ -1310,7 +1295,6 @@ func isEqField(fl FieldLevel) bool {
13101295 fieldType := field .Type ()
13111296
13121297 if fieldType .ConvertibleTo (timeType ) && currentField .Type ().ConvertibleTo (timeType ) {
1313-
13141298 t := currentField .Convert (timeType ).Interface ().(time.Time )
13151299 fieldTime := field .Convert (timeType ).Interface ().(time.Time )
13161300
@@ -1333,7 +1317,6 @@ func isEq(fl FieldLevel) bool {
13331317 param := fl .Param ()
13341318
13351319 switch field .Kind () {
1336-
13371320 case reflect .String :
13381321 return field .String () == param
13391322
@@ -1620,7 +1603,9 @@ func isImage(fl FieldLevel) bool {
16201603 if err != nil {
16211604 return false
16221605 }
1623- defer file .Close ()
1606+ defer func () {
1607+ _ = file .Close ()
1608+ }()
16241609
16251610 mime , err := mimetype .DetectReader (file )
16261611 if err != nil {
@@ -1850,7 +1835,6 @@ func requireCheckFieldValue(
18501835 }
18511836
18521837 switch kind {
1853-
18541838 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
18551839 return field .Int () == asInt (value )
18561840
@@ -2059,7 +2043,6 @@ func isGteField(fl FieldLevel) bool {
20592043 }
20602044
20612045 switch kind {
2062-
20632046 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
20642047
20652048 return field .Int () >= currentField .Int ()
@@ -2077,7 +2060,6 @@ func isGteField(fl FieldLevel) bool {
20772060 fieldType := field .Type ()
20782061
20792062 if fieldType .ConvertibleTo (timeType ) && currentField .Type ().ConvertibleTo (timeType ) {
2080-
20812063 t := currentField .Convert (timeType ).Interface ().(time.Time )
20822064 fieldTime := field .Convert (timeType ).Interface ().(time.Time )
20832065
@@ -2105,7 +2087,6 @@ func isGtField(fl FieldLevel) bool {
21052087 }
21062088
21072089 switch kind {
2108-
21092090 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
21102091
21112092 return field .Int () > currentField .Int ()
@@ -2123,7 +2104,6 @@ func isGtField(fl FieldLevel) bool {
21232104 fieldType := field .Type ()
21242105
21252106 if fieldType .ConvertibleTo (timeType ) && currentField .Type ().ConvertibleTo (timeType ) {
2126-
21272107 t := currentField .Convert (timeType ).Interface ().(time.Time )
21282108 fieldTime := field .Convert (timeType ).Interface ().(time.Time )
21292109
@@ -2146,7 +2126,6 @@ func isGte(fl FieldLevel) bool {
21462126 param := fl .Param ()
21472127
21482128 switch field .Kind () {
2149-
21502129 case reflect .String :
21512130 p := asInt (param )
21522131
@@ -2180,7 +2159,6 @@ func isGte(fl FieldLevel) bool {
21802159 case reflect .Struct :
21812160
21822161 if field .Type ().ConvertibleTo (timeType ) {
2183-
21842162 now := time .Now ().UTC ()
21852163 t := field .Convert (timeType ).Interface ().(time.Time )
21862164
@@ -2197,7 +2175,6 @@ func isGt(fl FieldLevel) bool {
21972175 param := fl .Param ()
21982176
21992177 switch field .Kind () {
2200-
22012178 case reflect .String :
22022179 p := asInt (param )
22032180
@@ -2244,7 +2221,6 @@ func hasLengthOf(fl FieldLevel) bool {
22442221 param := fl .Param ()
22452222
22462223 switch field .Kind () {
2247-
22482224 case reflect .String :
22492225 p := asInt (param )
22502226
@@ -2295,7 +2271,6 @@ func isLteField(fl FieldLevel) bool {
22952271 }
22962272
22972273 switch kind {
2298-
22992274 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
23002275
23012276 return field .Int () <= currentField .Int ()
@@ -2313,7 +2288,6 @@ func isLteField(fl FieldLevel) bool {
23132288 fieldType := field .Type ()
23142289
23152290 if fieldType .ConvertibleTo (timeType ) && currentField .Type ().ConvertibleTo (timeType ) {
2316-
23172291 t := currentField .Convert (timeType ).Interface ().(time.Time )
23182292 fieldTime := field .Convert (timeType ).Interface ().(time.Time )
23192293
@@ -2341,7 +2315,6 @@ func isLtField(fl FieldLevel) bool {
23412315 }
23422316
23432317 switch kind {
2344-
23452318 case reflect .Int , reflect .Int8 , reflect .Int16 , reflect .Int32 , reflect .Int64 :
23462319
23472320 return field .Int () < currentField .Int ()
@@ -2359,7 +2332,6 @@ func isLtField(fl FieldLevel) bool {
23592332 fieldType := field .Type ()
23602333
23612334 if fieldType .ConvertibleTo (timeType ) && currentField .Type ().ConvertibleTo (timeType ) {
2362-
23632335 t := currentField .Convert (timeType ).Interface ().(time.Time )
23642336 fieldTime := field .Convert (timeType ).Interface ().(time.Time )
23652337
@@ -2382,7 +2354,6 @@ func isLte(fl FieldLevel) bool {
23822354 param := fl .Param ()
23832355
23842356 switch field .Kind () {
2385-
23862357 case reflect .String :
23872358 p := asInt (param )
23882359
@@ -2416,7 +2387,6 @@ func isLte(fl FieldLevel) bool {
24162387 case reflect .Struct :
24172388
24182389 if field .Type ().ConvertibleTo (timeType ) {
2419-
24202390 now := time .Now ().UTC ()
24212391 t := field .Convert (timeType ).Interface ().(time.Time )
24222392
@@ -2433,7 +2403,6 @@ func isLt(fl FieldLevel) bool {
24332403 param := fl .Param ()
24342404
24352405 switch field .Kind () {
2436-
24372406 case reflect .String :
24382407 p := asInt (param )
24392408
0 commit comments