From deec3516d53e9a9679128ade0556ccc818a67be1 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 6 Mar 2022 16:33:45 +0800 Subject: autofix: fix check for empty string (#6804) Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> --- internal/template/template.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/template/template.go') diff --git a/internal/template/template.go b/internal/template/template.go index e904e6e9..dcb56639 100644 --- a/internal/template/template.go +++ b/internal/template/template.go @@ -93,7 +93,7 @@ func FuncMap() []template.FuncMap { return t.Format("Jan 02, 2006") }, "SubStr": func(str string, start, length int) string { - if len(str) == 0 { + if str == "" { return "" } end := start + length @@ -186,7 +186,7 @@ func RenderCommitMessage(full bool, msg, urlPrefix string, metas map[string]stri return "" } else if !full { return msgLines[0] - } else if numLines == 1 || (numLines >= 2 && len(msgLines[1]) == 0) { + } else if numLines == 1 || (numLines >= 2 && msgLines[1] == "") { // First line is a header, standalone or followed by empty line header := fmt.Sprintf("