diff --git a/src/go/ast/ast.go b/src/go/ast/ast.go index 6420253b48a..4658f92478a 100644 --- a/src/go/ast/ast.go +++ b/src/go/ast/ast.go @@ -8,6 +8,7 @@ package ast import ( "go/token" + "runtime" "strings" ) @@ -95,9 +96,16 @@ func (g *CommentGroup) Raw() string { if g == nil { return "" } - var b strings.Builder + var ( + b strings.Builder + ls = "\n" + ) + if runtime.GOOS == "windows" { + ls = "\r\n" + } + for _, c := range g.List { - b.WriteString(c.Text + "\n") + b.WriteString(c.Text + ls) } return b.String() }