mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-19 20:15:02 +00:00
build: add dynamic version injection via ldflags and Makefile
- Add cmd.Version variable set at build time via -ldflags - Fix Dockerfile ldflags path to use cmd.Version instead of main.version - Add Makefile with auto-detection from git tags (git describe) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
6066adc15a
commit
a0ef0c2f91
3 files changed
+22
-2
No files matched your search
+4
-1
@@ -9,6 +9,9 @@ import (
|
||||
"github.com/nextlevelbuilder/goclaw/pkg/protocol"
|
||||
)
|
||||
|
||||
// Version is set at build time via -ldflags "-X github.com/nextlevelbuilder/goclaw/cmd.Version=v1.0.0"
|
||||
var Version = "dev"
|
||||
|
||||
var (
|
||||
cfgFile string
|
||||
verbose bool
|
||||
@@ -46,7 +49,7 @@ func versionCmd() *cobra.Command {
|
||||
Use: "version",
|
||||
Short: "Print version information",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("goclaw v0.2.0 (protocol %d)\n", protocol.ProtocolVersion)
|
||||
fmt.Printf("goclaw %s (protocol %d)\n", Version, protocol.ProtocolVersion)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user