move versionFromBuild()

This commit is contained in:
2026-08-19 14:05:27 +01:00
parent acdce03d85
commit 8c257d5f2e

24
main.go
View File

@@ -17,6 +17,18 @@ import (
var version string // Version of the CLI, set during build time
func versionFromBuild() string {
if version != "" {
return version
}
info, ok := debug.ReadBuildInfo()
if !ok {
return "(unable to read version)"
}
return strings.Split(info.Main.Version, "-")[0]
}
// rootCmd represents the base command when called without any subcommands.
var rootCmd = &cobra.Command{
Use: "gogn",
@@ -73,15 +85,3 @@ func main() {
os.Exit(1)
}
}
func versionFromBuild() string {
if version != "" {
return version
}
info, ok := debug.ReadBuildInfo()
if !ok {
return "(unable to read version)"
}
return strings.Split(info.Main.Version, "-")[0]
}