From 490b8784adcd11436fc42270f6a5bd4b95ef9778 Mon Sep 17 00:00:00 2001 From: mrrishi Date: Mon, 25 Nov 2024 23:19:12 +0530 Subject: [PATCH] remove stat --- cmd/k3d/destroy.go | 6 ++---- cmd/reset.go | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cmd/k3d/destroy.go b/cmd/k3d/destroy.go index 8fbea220e..0c0af4756 100644 --- a/cmd/k3d/destroy.go +++ b/cmd/k3d/destroy.go @@ -223,10 +223,8 @@ func destroyK3d(_ *cobra.Command, _ []string) error { viper.WriteConfig() } - if _, err := os.Stat(config.K1Dir); !os.IsNotExist(err) { - if err := os.RemoveAll(config.K1Dir); err != nil { - return fmt.Errorf("unable to delete %q: %w", config.K1Dir, err) - } + if err := os.RemoveAll(config.K1Dir); err != nil { + return fmt.Errorf("unable to delete %q: %w", config.K1Dir, err) } time.Sleep(200 * time.Millisecond) fmt.Printf("Your kubefirst platform running in %q has been destroyed.", k3d.CloudProvider) diff --git a/cmd/reset.go b/cmd/reset.go index 81c1a39f8..853afa4a9 100755 --- a/cmd/reset.go +++ b/cmd/reset.go @@ -127,10 +127,8 @@ func runReset() error { return fmt.Errorf("error writing viper config: %w", err) } - if _, err := os.Stat(k1Dir); !os.IsNotExist(err) { - if err := os.RemoveAll(k1Dir); err != nil { - return fmt.Errorf("unable to delete %q folder, error: %w", k1Dir, err) - } + if err := os.RemoveAll(k1Dir); err != nil { + return fmt.Errorf("unable to delete %q folder, error: %w", k1Dir, err) } progressPrinter.IncrementTracker("removing-platform-content")