Go.mod comments: trim newlines

These weren't previously reported as part of the comment text, but are as of the latest version of golang.org/x/tools
This commit is contained in:
Chris Smowton
2020-09-03 15:54:56 +01:00
parent 380410e687
commit 47958e6de8

View File

@@ -168,7 +168,7 @@ func extractGoModComments(tw *trap.Writer, expr modfile.Expr, exprlbl trap.Label
var first bool = true
idx := 0
for _, comment := range allComments {
commentToken := strings.TrimSuffix(comment.Token, "\r")
commentToken := strings.TrimSuffix(strings.TrimSuffix(comment.Token, "\n"), "\r")
extractGoModComment(tw, comment, commentToken, grouplbl, idx)
idx++
commentEndCol := comment.Start.LineRune + (len(commentToken) - 1)