From 3f1f6985119d73a00e9150d244fc108914e49de5 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Tue, 7 Dec 2021 16:57:53 -0400 Subject: [PATCH] fix(docgen): trim trailing space from doc comments --- cmd/docgen/docgen.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index c69fe84..f0dd14e 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -53,7 +53,8 @@ func main() { mod := l if strings.HasPrefix(t.Name, "hl") { mod = "hilbish" } if !strings.HasPrefix(t.Name, prefix[mod]) || t.Name == "Loader" { continue } - parts := strings.Split(t.Doc, "\n") + docParts := strings.TrimSpace(t.Doc) + parts := strings.Split(docParts, "\n") funcsig := parts[0] doc := parts[1:] @@ -62,7 +63,9 @@ func main() { for _, t := range p.Types { for _, m := range t.Methods { if !strings.HasPrefix(m.Name, prefix[l]) || m.Name == "Loader" { continue } - parts := strings.Split(m.Doc, "\n") + // trim extra spaces from the doc + docParts := strings.TrimSpace(m.Doc) + parts := strings.Split(docParts, "\n") funcsig := parts[0] doc := parts[1:]