| 12345678910111213141516171819202122 |
- package version
- import "runtime/debug"
- // Build-time parameters set via -ldflags
- var Version = "devel"
- // A user may install crush using `go install github.com/charmbracelet/crush@latest`.
- // without -ldflags, in which case the version above is unset. As a workaround
- // we use the embedded build version that *is* set when using `go install` (and
- // is only set for `go install` and not for `go build`).
- func init() {
- info, ok := debug.ReadBuildInfo()
- if !ok {
- return
- }
- mainVersion := info.Main.Version
- if mainVersion != "" && mainVersion != "(devel)" {
- Version = mainVersion
- }
- }
|