From e6f158873f92d84aba0eec17ce42d71d85cb59e6 Mon Sep 17 00:00:00 2001 From: Chance Date: Sat, 28 Sep 2024 15:15:06 +0800 Subject: [PATCH] fix: priority accurate matching version (#329) * fix: priority accurate matching version * Revert `PreUse` hook --- internal/sdk.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/sdk.go b/internal/sdk.go index a546033..f1db7a3 100644 --- a/internal/sdk.go +++ b/internal/sdk.go @@ -332,6 +332,10 @@ func (b *Sdk) PreUse(version Version, scope UseScope) (Version, error) { // not want to change the version or not implement the PreUse function. // We can simply fuzzy match the version based on the input version. if newVersion == "" { + // Before fuzzy matching, perform exact matching first. + if b.CheckExists(version) { + return version, nil + } installedVersions := make(util.VersionSort, 0, len(installedSdks)) for _, sdk := range installedSdks { installedVersions = append(installedVersions, string(sdk.Main.Version))