From 8721cff4dfff35fd956868c4d0a3a635faea9cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sat, 12 Oct 2024 18:42:01 +0800 Subject: [PATCH] fix: lint --- internal/apps/openresty/service.go | 4 ++-- internal/apps/supervisor/service.go | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/apps/openresty/service.go b/internal/apps/openresty/service.go index 19b73d0a..782659f6 100644 --- a/internal/apps/openresty/service.go +++ b/internal/apps/openresty/service.go @@ -58,12 +58,12 @@ func (s *Service) SaveConfig(w http.ResponseWriter, r *http.Request) { } func (s *Service) ErrorLog(w http.ResponseWriter, r *http.Request) { - out, _ := shell.Execf("tail -n 100 %s/%s", app.Root, "wwwlogs/openresty-error.log") + out, _ := shell.Execf("tail -n 100 %s/%s", app.Root, "wwwlogs/nginx-error.log") service.Success(w, out) } func (s *Service) ClearErrorLog(w http.ResponseWriter, r *http.Request) { - if _, err := shell.Execf("echo '' > %s/%s", app.Root, "wwwlogs/openresty-error.log"); err != nil { + if _, err := shell.Execf("echo '' > %s/%s", app.Root, "wwwlogs/nginx-error.log"); err != nil { service.Error(w, http.StatusInternalServerError, "%v", err) return } diff --git a/internal/apps/supervisor/service.go b/internal/apps/supervisor/service.go index 56446c77..b57eed8a 100644 --- a/internal/apps/supervisor/service.go +++ b/internal/apps/supervisor/service.go @@ -1,7 +1,6 @@ package supervisor import ( - "fmt" "net/http" "strings" @@ -201,7 +200,7 @@ func (s *Service) ProcessLog(w http.ResponseWriter, r *http.Request) { } if err != nil { - service.Error(w, http.StatusInternalServerError, fmt.Sprintf("无法从进程 %s 的配置文件中获取日志路径", req.Process)) + service.Error(w, http.StatusInternalServerError, "无法从进程 %s 的配置文件中获取日志路径", req.Process) return } @@ -225,7 +224,7 @@ func (s *Service) ClearProcessLog(w http.ResponseWriter, r *http.Request) { } if err != nil { - service.Error(w, http.StatusInternalServerError, fmt.Sprintf("无法从进程 %s 的配置文件中获取日志路径", req.Process)) + service.Error(w, http.StatusInternalServerError, "无法从进程 %s 的配置文件中获取日志路径", req.Process) return } @@ -342,7 +341,7 @@ func (s *Service) DeleteProcess(w http.ResponseWriter, r *http.Request) { if os.IsRHEL() { logPath, err = shell.Execf(`cat '/etc/supervisord.d/%s.conf' | grep stdout_logfile= | awk -F "=" '{print $2}'`, req.Process) if err != nil { - service.Error(w, http.StatusInternalServerError, fmt.Sprintf("无法从进程 %s 的配置文件中获取日志路径", req.Process)) + service.Error(w, http.StatusInternalServerError, "无法从进程 %s 的配置文件中获取日志路径", req.Process) return } if err = io.Remove(`/etc/supervisord.d/` + req.Process + `.conf`); err != nil { @@ -352,7 +351,7 @@ func (s *Service) DeleteProcess(w http.ResponseWriter, r *http.Request) { } else { logPath, err = shell.Execf(`cat '/etc/supervisor/conf.d/%s.conf' | grep stdout_logfile= | awk -F "=" '{print $2}'`, req.Process) if err != nil { - service.Error(w, http.StatusInternalServerError, fmt.Sprintf("无法从进程 %s 的配置文件中获取日志路径", req.Process)) + service.Error(w, http.StatusInternalServerError, "无法从进程 %s 的配置文件中获取日志路径", req.Process) return } if err = io.Remove(`/etc/supervisor/conf.d/` + req.Process + `.conf`); err != nil {