mirror of
https://github.com/onyx-and-iris/ignr.git
synced 2026-08-21 12:14:24 +00:00
move versionFromBuild()
This commit is contained in:
24
main.go
24
main.go
@@ -16,6 +16,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: "ignr",
|
||||
@@ -79,15 +91,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]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user