This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/server/version.go
2026-03-04 17:39:22 +00:00

30 lines
624 B
Go

package main
import (
"os"
"strings"
)
// Version is set at build time via:
//
// go build -ldflags "-X main.Version=$(cat VERSION)"
//
// Falls back to reading /VERSION or ./VERSION for container/local runs
// without ldflags. Final fallback is "dev".
var Version = "dev"
func init() {
if Version != "dev" {
return
}
// Try well-known paths: container (/VERSION), repo root (../VERSION, ./VERSION)
for _, path := range []string{"/VERSION", "VERSION", "../VERSION"} {
if data, err := os.ReadFile(path); err == nil {
if v := strings.TrimSpace(string(data)); v != "" {
Version = v
return
}
}
}
}