Skip to content

Commit 3b46101

Browse files
committed
Move version injection into main and allow setting root.Version. This allows us to use the default goreleaser version number injection settings
1 parent 147a57f commit 3b46101

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cmd/hkmgr/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import (
66
"github.com/bensallen/hkmgr/internal/root"
77
)
88

9+
var version = "unknown"
10+
911
func main() {
12+
root.Version = version
1013
if err := root.Run(); err != nil {
1114
fmt.Printf("Error: %v\n", err)
1215
}

internal/root/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/kr/pretty"
1818
)
1919

20-
var version = "unknown"
20+
var Version = "unknown"
2121

2222
func Run() error {
2323
var upSubcommand *flaggy.Subcommand
@@ -82,7 +82,7 @@ func Run() error {
8282
//flaggy.AttachSubcommand(sshSubcommand, 1)
8383
//flaggy.AttachSubcommand(consoleSubcommand, 1)
8484

85-
flaggy.SetVersion(version)
85+
flaggy.SetVersion(Version)
8686
flaggy.Parse()
8787

8888
if dryRun {

0 commit comments

Comments
 (0)