From 4e01168f3c0670f74cf2ae478ae2a88195327edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sat, 28 Sep 2024 11:52:52 +0800 Subject: [PATCH] fix: lint --- internal/data/app.go | 4 ++-- pkg/types/monitor.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/data/app.go b/internal/data/app.go index 5bb87030..476228b1 100644 --- a/internal/data/app.go +++ b/internal/data/app.go @@ -4,10 +4,10 @@ import ( "encoding/json" "errors" "fmt" - "github.com/spf13/cast" "slices" "github.com/expr-lang/expr" + "github.com/spf13/cast" "github.com/TheTNB/panel/internal/biz" "github.com/TheTNB/panel/internal/panel" @@ -284,7 +284,7 @@ func (r *appRepo) preCheck(app *api.App) error { } output, err := expr.Eval(app.Depends, env) if err != nil { - + return err } result := cast.ToString(output) diff --git a/pkg/types/monitor.go b/pkg/types/monitor.go index 1e5492de..d340ac85 100644 --- a/pkg/types/monitor.go +++ b/pkg/types/monitor.go @@ -5,25 +5,30 @@ type Load struct { Load5 []float64 `json:"load5"` Load15 []float64 `json:"load15"` } + type CPU struct { Percent []string `json:"percent"` } + type Mem struct { Total string `json:"total"` Available []string `json:"available"` Used []string `json:"used"` } + type SWAP struct { Total string `json:"total"` Used []string `json:"used"` Free []string `json:"free"` } + type Network struct { Sent []string `json:"sent"` Recv []string `json:"recv"` Tx []string `json:"tx"` Rx []string `json:"rx"` } + type MonitorData struct { Times []string `json:"times"` Load Load `json:"load"`