GoReleaser builds static binaries for linux/darwin on amd64/arm64, injecting version via ldflags. Version command prints the embedded version (defaults to "dev" for local builds). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22 lines
288 B
Go
22 lines
288 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var version = "dev"
|
|
|
|
var versionCmd = &cobra.Command{
|
|
Use: "version",
|
|
Short: "Print the version",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
fmt.Println(version)
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(versionCmd)
|
|
}
|