diff options
author | deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> | 2022-03-06 16:33:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 16:33:45 +0800 |
commit | deec3516d53e9a9679128ade0556ccc818a67be1 (patch) | |
tree | b5c1c5d55be05a244180ece0b822e7e35dc68f42 /internal/template/template.go | |
parent | 65526f84e1d382ac01b7379f40fc56b2660d1074 (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/template/template.go')
-rw-r--r-- | internal/template/template.go | 4 |
1 files changed, 2 insertions, 2 deletions
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("<h3>%s</h3>", msgLines[0]) if numLines >= 2 { |