From 675fbae88b66eb79db7e6cbb6ee47b0cb6f3fc51 Mon Sep 17 00:00:00 2001 From: lzy <674194901@qq.com> Date: Tue, 19 Nov 2024 12:10:23 +0800 Subject: [PATCH] refactor: `checkIfResourceExists` function --- internal/cli/utils/checker.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/cli/utils/checker.go b/internal/cli/utils/checker.go index 33cb548e..81f43c32 100644 --- a/internal/cli/utils/checker.go +++ b/internal/cli/utils/checker.go @@ -112,14 +112,14 @@ func checkIfResourceExists(checkCmd string, resourceList ...string) bool { cmd := exec.Command("sh", "-c", checkCmd) var out bytes.Buffer cmd.Stdout = &out - err := cmd.Run() - if err != nil { + if err := cmd.Run(); err != nil { return false } + output := out.Bytes() for _, resource := range resourceList { - if !bytes.Contains(out.Bytes(), []byte(resource)) { + if !bytes.Contains(output, []byte(resource)) { return false } }