aboutsummaryrefslogtreecommitdiff
path: root/internal/form
diff options
context:
space:
mode:
authordeepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>2022-03-06 16:33:45 +0800
committerGitHub <noreply@github.com>2022-03-06 16:33:45 +0800
commitdeec3516d53e9a9679128ade0556ccc818a67be1 (patch)
treeb5c1c5d55be05a244180ece0b822e7e35dc68f42 /internal/form
parent65526f84e1d382ac01b7379f40fc56b2660d1074 (diff)
autofix: fix check for empty string (#6804)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/form')
-rw-r--r--internal/form/form.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/form/form.go b/internal/form/form.go
index e2fe1a1f..db6e040b 100644
--- a/internal/form/form.go
+++ b/internal/form/form.go
@@ -57,7 +57,7 @@ func Assign(form interface{}, data map[string]interface{}) {
// Allow ignored fields in the struct
if fieldName == "-" {
continue
- } else if len(fieldName) == 0 {
+ } else if fieldName == "" {
fieldName = com.ToSnakeCase(field.Name)
}
@@ -119,7 +119,7 @@ func validate(errs binding.Errors, data map[string]interface{}, f Form, l macaro
data["Err_"+field.Name] = true
trName := field.Tag.Get("locale")
- if len(trName) == 0 {
+ if trName == "" {
trName = l.Tr("form." + field.Name)
} else {
trName = l.Tr(trName)