Skip to content

Commit 798440a

Browse files
committed
Fixed hardcoded version
1 parent 848e8b2 commit 798440a

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

cmd/root.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ func Execute() error {
2222
return rootCmd.Execute()
2323
}
2424

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+
2530
func init() {
26-
// Add version flag
27-
rootCmd.Version = "1.0.0"
2831
rootCmd.SetVersionTemplate("git-wt version {{.Version}}\n")
2932
}
3033

main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import (
66
"github.com/shogs/git-wt/cmd"
77
)
88

9+
// version is set via ldflags by GoReleaser
10+
var version = "dev"
11+
912
func main() {
13+
cmd.SetVersion(version)
1014
if err := cmd.Execute(); err != nil {
1115
os.Exit(1)
1216
}

0 commit comments

Comments
 (0)