Skip to content

Commit

Permalink
feat: add variable to fill in with git tag for version flag.
Browse files Browse the repository at this point in the history
AppVersion is a variable that we can fill-in at build time via
ldflags[1].
Especially useful is the `go nm` tool which will print out the symbols
and their "path".

[1]: https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications
  • Loading branch information
Adam Simpson committed Jun 11, 2021
1 parent c4d1cf6 commit e79b3ca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import (
"github.com/spf13/cobra"
)

var AppVersion string

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "sb",
Short: "A cli to automate various things around Sparkbox.",
//AppVersion is pulled from the latest git tag at compile time.
Version: AppVersion,
Long: `For now we use Slack as our Authentication service in lieu of something like LDAP.
We currently only support generating SSH certificates for the various hosts we manage.
In the future we could handle things like onboarding here.`,
Expand Down

0 comments on commit e79b3ca

Please sign in to comment.