From c0d60f020b4fcff39d62f20019c064f792350104 Mon Sep 17 00:00:00 2001 From: qm012 Date: Wed, 23 Jun 2021 13:32:00 +0800 Subject: [PATCH] add code Robustness --- validator_instance.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/validator_instance.go b/validator_instance.go index 210433e..e9ac442 100644 --- a/validator_instance.go +++ b/validator_instance.go @@ -163,6 +163,8 @@ func (v *Validate) SetErrTagName(name string) { index := v.customTags.Position(defaultErrTagName) if index != -1 { v.customTags[index] = name + } else { + v.customTags = append(v.customTags, name) } defaultErrTagName = name }