Skip to content

Commit 0fa7229

Browse files
committed
Account for Windows
1 parent eedb454 commit 0fa7229

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

grpc/codegen/templates.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package codegen
33
import (
44
"embed"
55
"path"
6+
"runtime"
67
"strings"
78
)
89

@@ -19,7 +20,12 @@ func readTemplate(name string, partials ...string) string {
1920
panic("failed to read partial template " + partial + ": " + err.Error()) // Should never happen, bug if it does
2021
}
2122
tmpl.Write(data)
22-
tmpl.WriteByte('\n')
23+
// Add a newline to separate the partials, OS specific
24+
if runtime.GOOS == "windows" {
25+
tmpl.WriteString("\r\n")
26+
} else {
27+
tmpl.WriteString("\n")
28+
}
2329
}
2430
}
2531
data, err := tmplFS.ReadFile(path.Join("templates", name) + ".go.tpl")

0 commit comments

Comments
 (0)