aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ast/format.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/ast/format.go')
-rw-r--r--pkg/ast/format.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/ast/format.go b/pkg/ast/format.go
index 6b16f4015..51538eaf1 100644
--- a/pkg/ast/format.go
+++ b/pkg/ast/format.go
@@ -7,6 +7,7 @@ import (
"bytes"
"fmt"
"io"
+ "strings"
)
func Format(desc *Description) []byte {
@@ -70,7 +71,7 @@ func (n *NewLine) serialize(w io.Writer) {
}
func (n *Comment) serialize(w io.Writer) {
- fmt.Fprintf(w, "#%v\n", n.Text)
+ fmt.Fprintf(w, "#%v\n", strings.TrimRight(n.Text, " \t"))
}
func (n *Include) serialize(w io.Writer) {
@@ -138,7 +139,7 @@ func (n *Struct) serialize(w io.Writer) {
fmt.Fprintf(w, "\n")
}
for _, com := range f.Comments {
- fmt.Fprintf(w, "#%v\n", com.Text)
+ com.serialize(w)
}
fmt.Fprintf(w, "\t%v\t", f.Name.Name)
for tabs := len(f.Name.Name)/tabWidth + 1; tabs < maxTabs; tabs++ {
@@ -151,7 +152,7 @@ func (n *Struct) serialize(w io.Writer) {
fmt.Fprintf(w, "\n")
}
for _, com := range n.Comments {
- fmt.Fprintf(w, "#%v\n", com.Text)
+ com.serialize(w)
}
fmt.Fprintf(w, "%c", closing)
if attrs := fmtTypeList(n.Attrs, "[", "]"); attrs != "" {