Skip to content

Commit

Permalink
Merge pull request #30 from raskyld/27-build-wrong-version-number-whe…
Browse files Browse the repository at this point in the history
…n-using-go-install

fix: use VCS info for Version
  • Loading branch information
raskyld authored Oct 31, 2023
2 parents 3e2bd38 + aefa2de commit 291255e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,24 @@ package main

import (
"fmt"
"github.com/raskyld/go-tektasker/cmd"
"os"
"runtime/debug"

"github.com/raskyld/go-tektasker/cmd"
)

// Version is backed-in during the build process by the linker
var Version = "dev"
var Version string

func main() {
if Version == "" {
info, ok := debug.ReadBuildInfo()

if ok {
Version = info.Main.Version
}
}

cli := cmd.New(Version)
if err := cli.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err.Error())
Expand Down

0 comments on commit 291255e

Please sign in to comment.