From 50f5b1699030e200a06134696bcb326de9e8e90c Mon Sep 17 00:00:00 2001 From: wuhuizuo Date: Thu, 2 Jan 2020 11:07:06 +0800 Subject: [PATCH] [FIX] according review issue --- binding/binding.go | 4 ++-- binding/default_validator_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binding/binding.go b/binding/binding.go index e707c875..dce95e81 100644 --- a/binding/binding.go +++ b/binding/binding.go @@ -50,8 +50,8 @@ type BindingUri interface { // of the request. Gin provides a default implementation for this using // https://github.com/go-playground/validator/tree/v8.18.2. type Validater interface { - // Validate can receive any kind of type and it should never panic, even if the configuration is not right. - // If the received type is not a struct, any validation should be skipped and nil must be returned. + // If the received type is a slice|array, the validation should be performed travel on every element. + // If the received type is not a struct or slice|array, any validation should be skipped and nil must be returned. // If the received type is a struct or pointer to a struct, the validation should be performed. // If the struct is not valid or the validation itself fails, a descriptive error should be returned. // Otherwise nil must be returned. diff --git a/binding/default_validator_test.go b/binding/default_validator_test.go index 12594594..b8709c73 100644 --- a/binding/default_validator_test.go +++ b/binding/default_validator_test.go @@ -1,4 +1,4 @@ -// Copyright 2017 Manu Martinez-Almeida. All rights reserved. +// Copyright 2020 Gin Core Team. All rights reserved. // Use of this source code is governed by a MIT style // license that can be found in the LICENSE file. @@ -9,7 +9,7 @@ import ( "testing" ) -func Test_sliceValidateError_Error(t *testing.T) { +func TestSliceValidateError_Error(t *testing.T) { tests := []struct { name string err sliceValidateError