mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2026-02-02 09:25:08 +01:00
feat(cli): --version using ldflags
The go-modules approach is a bit broken: https://github.com/golang/go/issues/29228 To resolve that, we now compute that version using `git describe` and set it using `ldflags`. While this is not as nice/builtin as the other approach, it at least works all the time and across go versions. Furthermore, I did refactor the Makefile in preparation for an AUR package that builds from source and for building release artifacts in CI.
This commit is contained in:
parent
f8be6a936f
commit
80c06a483a
4 changed files with 37 additions and 83 deletions
|
|
@ -21,6 +21,7 @@ import (
|
|||
|
||||
"github.com/fatih/color"
|
||||
"github.com/pkg/errors"
|
||||
"gopkg.in/alecthomas/kingpin.v2"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -30,6 +31,8 @@ const (
|
|||
rewriteActionName = "rewrite"
|
||||
)
|
||||
|
||||
var Version = "dev"
|
||||
|
||||
func main() {
|
||||
os.Exit(Main())
|
||||
}
|
||||
|
|
@ -41,7 +44,7 @@ func Main() int {
|
|||
|
||||
color.Output = color.Error
|
||||
|
||||
a := newApp()
|
||||
a := kingpin.New(filepath.Base(os.Args[0]), "A jsonnet package manager").Version(Version)
|
||||
a.HelpFlag.Short('h')
|
||||
|
||||
a.Flag("jsonnetpkg-home", "The directory used to cache packages in.").
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue