func mkDaemonFromEngine(eng *engine.Engine, t log.Fataler) *daemon.Daemon { iDaemon := eng.Hack_GetGlobalVar("httpapi.daemon") if iDaemon == nil { panic("Legacy daemon field not set in engine") } daemon, ok := iDaemon.(*daemon.Daemon) if !ok { panic("Legacy daemon field in engine does not cast to *daemon.Daemon") } return daemon }