cmd/drover: replace MessageBox stub with Wails GUI (internal/gui.Run)
Build / test (push) Has been cancelled
Build / build-windows (push) Has been cancelled

Bare 'drover' (and 'drover gui') no longer pop a Win32 MessageBox —
they hand off to internal/gui which mounts a real Wails window with
the Classic React variant. The old gui_windows.go / gui_other.go
files are removed; their job is now done by internal/gui/run.go.

Auto-update on startup is unchanged — still runs before gui.Run().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-01 15:16:56 +03:00
parent 15495d41ea
commit 13c32c90d5
6 changed files with 121 additions and 79 deletions
-9
View File
@@ -1,9 +0,0 @@
//go:build !windows
package main
import "fmt"
func showTestWindow() {
fmt.Printf("Drover-Go v%s — test window unavailable on non-Windows builds\n", Version)
}
-52
View File
@@ -1,52 +0,0 @@
//go:build windows
package main
import (
"fmt"
"runtime"
"unsafe"
"golang.org/x/sys/windows"
)
// showTestWindow displays a native Win32 MessageBox with build info.
// The intent is to give end-users a visual smoke-test on first run:
// double-click drover.exe (or run `drover gui`) and see that:
// 1. the binary actually launches on Windows,
// 2. the embedded version metadata is correct,
// 3. the process can talk to user32.dll (i.e. the runtime is healthy).
//
// This is *not* the production GUI — that comes later via Wails. Here we
// purposely use only stdlib + golang.org/x/sys/windows so this works
// before any Wails/CGO machinery is wired up.
func showTestWindow() {
user32 := windows.NewLazySystemDLL("user32.dll")
messageBox := user32.NewProc("MessageBoxW")
body := fmt.Sprintf(
"Drover-Go v%s\n\n"+
"Commit: %s\n"+
"Build: %s\n"+
"Go: %s\n"+
"Arch: %s/%s\n\n"+
"OK — the binary launched and the Windows API is reachable.",
Version, Commit, BuildDate, runtime.Version(), runtime.GOOS, runtime.GOARCH,
)
title := fmt.Sprintf("Drover-Go v%s — test window", Version)
bodyW, _ := windows.UTF16PtrFromString(body)
titleW, _ := windows.UTF16PtrFromString(title)
// MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST
// MB_TOPMOST is essential — without it the message box can pop up
// behind other windows and the user thinks nothing happened.
const flags = 0x00000000 | 0x00000040 | 0x00010000 | 0x00040000
messageBox.Call(
0,
uintptr(unsafe.Pointer(bodyW)),
uintptr(unsafe.Pointer(titleW)),
flags,
)
}
+7 -8
View File
@@ -7,6 +7,7 @@ import (
"github.com/spf13/cobra"
"git.okcu.io/root/drover-go/internal/gui"
"git.okcu.io/root/drover-go/internal/updater"
)
@@ -46,13 +47,12 @@ func newRootCmd() *cobra.Command {
SilenceUsage: true,
SilenceErrors: false,
// No subcommand and no flags = end-user double-clicked the exe.
// First do a quick update check (silent if no network or already
// current); if an update is available we prompt, apply, and
// re-launch ourselves. Then show the smoke-test window.
// First do a quick silent update check (no-op if offline or
// already current); if an update is available we apply it and
// re-launch ourselves. Then we open the Wails-backed GUI.
RunE: func(cmd *cobra.Command, args []string) error {
autoUpdateOnStartup()
showTestWindow()
return nil
return gui.Run(Version)
},
}
@@ -72,10 +72,9 @@ func newRootCmd() *cobra.Command {
func newGUICmd() *cobra.Command {
return &cobra.Command{
Use: "gui",
Short: "Show a test window (smoke check that the binary launches on this machine)",
Short: "Open the Drover-Go window (same as launching the exe with no args)",
RunE: func(cmd *cobra.Command, args []string) error {
showTestWindow()
return nil
return gui.Run(Version)
},
}
}