diff --git a/cmd/server/main.go b/cmd/server/main.go index c85e88a..dcb1aef 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -6,6 +6,7 @@ import ( "log/slog" "net/http" "os" + "runtime/debug" "strings" "github.com/spf13/cobra" @@ -18,6 +19,14 @@ import ( var Version = "dev" +func init() { + if Version == "dev" { + if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "(devel)" { + Version = info.Main.Version + } + } +} + func main() { rootCmd := &cobra.Command{ Use: "sysdig-mcp-server",