From ea2b6370a99f3cba5d443143e3f3063a9b840112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E6=AC=A7?= Date: Tue, 14 May 2019 09:44:50 +0800 Subject: [PATCH] Update validate_test.go --- binding/validate_test.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/binding/validate_test.go b/binding/validate_test.go index 32ebed72..81f78834 100644 --- a/binding/validate_test.go +++ b/binding/validate_test.go @@ -6,7 +6,6 @@ package binding import ( "bytes" - "reflect" "testing" "time" @@ -200,15 +199,8 @@ type structCustomValidation struct { Integer int `binding:"notone"` } -// notOne is a custom validator meant to be used with `validator.v8` library. -// The method signature for `v9` is significantly different and this function -// would need to be changed for tests to pass after upgrade. -// See https://github.com/gin-gonic/gin/pull/1015. -func notOne( - v *validator.Validate, topStruct reflect.Value, currentStructOrField reflect.Value, - field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string, -) bool { - if val, ok := field.Interface().(int); ok { +func notOne(f1 validator.FieldLevel) bool { + if val, ok := f1.Field().Interface().(int); ok { return val != 1 } return false