diff --git a/cmd/picoclaw/main.go b/cmd/picoclaw/main.go index cd2aef2ac..cd3637a1b 100644 --- a/cmd/picoclaw/main.go +++ b/cmd/picoclaw/main.go @@ -12,8 +12,8 @@ import ( "embed" "fmt" "io" - "net/http" "io/fs" + "net/http" "os" "os/signal" "path/filepath" @@ -28,8 +28,8 @@ import ( "github.com/sipeed/picoclaw/pkg/channels" "github.com/sipeed/picoclaw/pkg/config" "github.com/sipeed/picoclaw/pkg/cron" - "github.com/sipeed/picoclaw/pkg/health" "github.com/sipeed/picoclaw/pkg/devices" + "github.com/sipeed/picoclaw/pkg/health" "github.com/sipeed/picoclaw/pkg/heartbeat" "github.com/sipeed/picoclaw/pkg/logger" "github.com/sipeed/picoclaw/pkg/migrate" diff --git a/pkg/health/server.go b/pkg/health/server.go index 6d8099a5e..77b36034d 100644 --- a/pkg/health/server.go +++ b/pkg/health/server.go @@ -10,31 +10,31 @@ import ( ) type Server struct { - server *http.Server - mu sync.RWMutex - ready bool - checks map[string]Check + server *http.Server + mu sync.RWMutex + ready bool + checks map[string]Check startTime time.Time } type Check struct { - Name string `json:"name"` - Status string `json:"status"` - Message string `json:"message,omitempty"` + Name string `json:"name"` + Status string `json:"status"` + Message string `json:"message,omitempty"` Timestamp time.Time `json:"timestamp"` } type StatusResponse struct { - Status string `json:"status"` - Uptime string `json:"uptime"` - Checks map[string]Check `json:"checks,omitempty"` + Status string `json:"status"` + Uptime string `json:"uptime"` + Checks map[string]Check `json:"checks,omitempty"` } func NewServer(host string, port int) *Server { mux := http.NewServeMux() s := &Server{ - ready: false, - checks: make(map[string]Check), + ready: false, + checks: make(map[string]Check), startTime: time.Now(), }