Skip to content

Commit

Permalink
fix: use version info from goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
tnyeanderson committed Apr 30, 2024
1 parent 33f5931 commit e105846
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import (

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Version: "v0.0.5",
Use: "ddns",
Short: "A simple DDNS server and client",
Use: "ddns",
Short: "A simple DDNS server and client",
Long: fmt.Sprintf(`A simple DDNS server and client.
ENVIRONMENT VARIABLES
Expand All @@ -23,7 +22,8 @@ ENVIRONMENT VARIABLES

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
func Execute(version string) {
rootCmd.Version = version
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
Expand Down
14 changes: 12 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
package main

import "github.com/tnyeanderson/ddns/cmd"
import (
"fmt"

"github.com/tnyeanderson/ddns/cmd"
)

// These get populated by goreleaser
var (
version = "dev"
commit = "none"
)

func main() {
cmd.Execute()
cmd.Execute(fmt.Sprintf("%s commit:%s", version, commit))
}

0 comments on commit e105846

Please sign in to comment.