From a937d152fb31eee5f5719409e86877989cc108b0 Mon Sep 17 00:00:00 2001 From: lihan Date: Sat, 18 May 2024 18:07:35 +0800 Subject: [PATCH] mod: clear env --- internal/sdk.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/sdk.go b/internal/sdk.go index 87462ae0..e5a06773 100644 --- a/internal/sdk.go +++ b/internal/sdk.go @@ -705,12 +705,6 @@ func (b *Sdk) label(version Version) string { func (b *Sdk) ClearCurrentEnv() error { current := b.Current() - fmt.Println("Cleaning up current link...") - curPath := filepath.Join(b.InstallPath, "current") - if err := os.RemoveAll(curPath); err != nil { - return fmt.Errorf("failed to remove current link, err:%w", err) - } - if current != "" { envKeys, err := b.MockEnvKeys(current, GlobalLocation) if err != nil { @@ -739,6 +733,12 @@ func (b *Sdk) ClearCurrentEnv() error { _ = envManager.Flush() } + fmt.Println("Cleaning up current link...") + curPath := filepath.Join(b.InstallPath, "current") + if err := os.RemoveAll(curPath); err != nil { + return fmt.Errorf("failed to remove current link, err:%w", err) + } + // clear tool versions toolVersion, err := toolset.NewMultiToolVersions([]string{ b.sdkManager.PathMeta.CurTmpPath,