From 04749bc4d487eeba404de40d250dd48f251350e8 Mon Sep 17 00:00:00 2001 From: Elias Rodrigues Date: Sat, 25 Jul 2020 23:06:22 -0300 Subject: [PATCH] Fix golangci-lint issues --- baked_in.go | 5 +---- validator_test.go | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/baked_in.go b/baked_in.go index caae8a7..0c05daa 100644 --- a/baked_in.go +++ b/baked_in.go @@ -2123,11 +2123,8 @@ func isDatetime(fl FieldLevel) bool { if field.Kind() == reflect.String { _, err := time.Parse(param, field.String()) - if err != nil { - return false - } - return true + return err == nil } panic(fmt.Sprintf("Bad field type %T", field.Interface())) diff --git a/validator_test.go b/validator_test.go index fe21574..d434e99 100644 --- a/validator_test.go +++ b/validator_test.go @@ -9375,7 +9375,7 @@ func TestUniqueValidationStructSlice(t *testing.T) { } } } - PanicMatches(t, func() { validate.Var(testStructs, "unique=C") }, "Bad field name C") + PanicMatches(t, func() { _ = validate.Var(testStructs, "unique=C") }, "Bad field name C") } func TestHTMLValidation(t *testing.T) { @@ -10143,7 +10143,7 @@ func TestGetTag(t *testing.T) { } val := New() - val.RegisterValidation("mytag", func(fl FieldLevel) bool { + _ = val.RegisterValidation("mytag", func(fl FieldLevel) bool { tag = fl.GetTag() return true })