diff --git a/main.go b/main.go index ab73214..5e2eeda 100644 --- a/main.go +++ b/main.go @@ -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] -}