From 0a9b67ba687a634900ce8a00cbe0924438da42ff Mon Sep 17 00:00:00 2001 From: oldme Date: Sat, 27 Apr 2024 19:22:02 +0800 Subject: [PATCH] use the correct sine separator --- src/go/ast/ast.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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() }