Skip to content

Commit 0ed79a9

Browse files
committed
Move version extraction to init
1 parent 7a79998 commit 0ed79a9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ var (
107107
testsFiles []string
108108
chdir string
109109

110-
version = "dev"
110+
version = "devel"
111111
commit = "none"
112112
date = "unknown"
113113

version.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ var (
1919

2020
func init() {
2121
RootCommand.AddCommand(VersionCommand)
22-
}
2322

24-
func versionInfo(cmd *cobra.Command, args []string) {
25-
if version == "dev" {
23+
if version == "devel" {
2624
info, ok := debug.ReadBuildInfo()
2725
if ok && strings.HasPrefix(info.Main.Version, "v") {
2826
version = info.Main.Version
@@ -41,5 +39,8 @@ func versionInfo(cmd *cobra.Command, args []string) {
4139
}
4240
}
4341

42+
}
43+
44+
func versionInfo(cmd *cobra.Command, args []string) {
4445
fmt.Printf("ntt %v, commit %s, built at %s\n", version, commit, date)
4546
}

0 commit comments

Comments
 (0)