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 ca0293cfb..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 + "/kubeconfig"); !os.IsNotExist(err) { - if err := os.Remove(k1Dir + "/kubeconfig"); err != nil { - return fmt.Errorf("unable to delete %q folder, error: %w", k1Dir+"/kubeconfig", 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")