Fall back to runtime/debug.BuildInfo when ldflags version is not set, so `go install` users see the actual module version instead of "dev". Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
18 lines
311 B
Go
18 lines
311 B
Go
package main
|
|
|
|
import (
|
|
"runtime/debug"
|
|
|
|
"codeberg.org/goern/forgejo-mcp/v2/cmd"
|
|
)
|
|
|
|
var Version = "dev"
|
|
|
|
func main() {
|
|
if Version == "dev" {
|
|
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" && info.Main.Version != "(devel)" {
|
|
Version = info.Main.Version
|
|
}
|
|
}
|
|
cmd.Execute(Version)
|
|
}
|