We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 848e8b2 commit 798440aCopy full SHA for 798440a
2 files changed
cmd/root.go
@@ -22,9 +22,12 @@ func Execute() error {
22
return rootCmd.Execute()
23
}
24
25
+// SetVersion sets the version for the CLI (called from main with ldflags value)
26
+func SetVersion(v string) {
27
+ rootCmd.Version = v
28
+}
29
+
30
func init() {
- // Add version flag
- rootCmd.Version = "1.0.0"
31
rootCmd.SetVersionTemplate("git-wt version {{.Version}}\n")
32
33
main.go
@@ -6,7 +6,11 @@ import (
6
"github.com/shogs/git-wt/cmd"
7
)
8
9
+// version is set via ldflags by GoReleaser
10
+var version = "dev"
11
12
func main() {
13
+ cmd.SetVersion(version)
14
if err := cmd.Execute(); err != nil {
15
os.Exit(1)
16
0 commit comments