Windows: handle failing to read the VERSION file

This commit is contained in:
David Dworken
2022-11-06 00:16:14 -07:00
parent f4925a0999
commit 6938035715

View File

@ -182,8 +182,12 @@ func buildServer() {
}
version, err := os.ReadFile("VERSION")
if err != nil {
if runtime.GOOS == "windows" {
version = []byte("174")
} else {
panic(fmt.Sprintf("failed to read VERSION file: %v", err))
}
}
cmd := exec.Command("go", "build", "-o", "/tmp/server", "-ldflags", fmt.Sprintf("-X main.ReleaseVersion=v0.%s", version), "backend/server/server.go")
var stdout bytes.Buffer
cmd.Stdout = &stdout