main.go
package main import ( "log" "net/http" "j3s.sh/gore/internal/assets" ) func main() { http.HandleFunc("GET /", indexHandler) http.Handle("GET /assets/", http.StripPrefix("/assets/", http.FileServer(http.FS(assets.Assets)))) http.HandleFunc("POST /add", addHandler) if err := SuperviseServices(services); err != nil { log.Fatal(err) } log.Println("Starting Gore server on :6043...") log.Fatal(http.ListenAndServe(":6043", nil)) } func SuperviseServices(services []*service) error { unwrapped := make([]*service, len(services)) for idx, svc := range services { unwrapped[idx] = svc.s } // Only supervise services after the SIGHUP handler is set up, otherwise a // particularly fast dhcp client (e.g. when running in qemu) might send // SIGHUP before the signal handler is set up, thereby killing init and // panic the system! superviseServices(unwrapped) return nil }