Files
playback/pkg/version/version.go
2026-01-25 17:13:15 -06:00

31 lines
566 B
Go

package version
import (
"os"
"path/filepath"
"runtime"
"strings"
)
// Version is set at build time or read from file
var Version = "dev"
// Get returns the application version
func Get() string {
if Version != "dev" {
return Version
}
// Try to read from VERSION file at runtime (for development)
_, filename, _, ok := runtime.Caller(0)
if ok {
root := filepath.Join(filepath.Dir(filename), "..", "..")
data, err := os.ReadFile(filepath.Join(root, "VERSION"))
if err == nil {
return strings.TrimSpace(string(data))
}
}
return Version
}