fix(debugger): extract MarteController into an importable controller package
Client/debugger was entirely package main, which Go forbids importing from
another module ("is a program, not an importable package") -- discovered
while wiring the new debugclient E2E tool against NewHeadlessMarteController.
Move martecontrol.go and its test into a new marte2debugger/controller
subpackage (package controller) and update Client/debugger/main.go to call
controller.NewMarteController/controller.DangerousCommandsEnabled. No
behavioral change to the browser-facing server.
This commit is contained in:
@@ -10,6 +10,8 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"marte2debugger/controller"
|
||||
|
||||
"marte2/common/wshub"
|
||||
)
|
||||
|
||||
@@ -21,7 +23,7 @@ var staticFiles embed.FS
|
||||
func main() {
|
||||
addr := flag.String("addr", ":7777", "HTTP listen address")
|
||||
sourcesFile := flag.String("sources-file", "", "JSON file for persistent source list")
|
||||
flag.BoolVar(&dangerousCommandsEnabled, "enable-dangerous-commands", false,
|
||||
flag.BoolVar(&controller.DangerousCommandsEnabled, "enable-dangerous-commands", false,
|
||||
"Allow FORCE/PAUSE/RESUME/STEP/BREAK/MSG commands from the browser (CR-4 safety gate)")
|
||||
flag.Parse()
|
||||
|
||||
@@ -29,7 +31,7 @@ func main() {
|
||||
sm := wshub.NewSourceManager(hub, *sourcesFile)
|
||||
hub.SetSourceManager(sm)
|
||||
|
||||
ctrl := NewMarteController(hub)
|
||||
ctrl := controller.NewMarteController(hub)
|
||||
|
||||
go hub.Run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user