1
0
mirror of https://github.com/golang/go synced 2024-11-24 20:20:03 -07:00

use the correct sine separator

This commit is contained in:
oldme 2024-04-27 19:22:02 +08:00
parent 0510b3ac10
commit 0a9b67ba68

View File

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