Skip to content

Commit

Permalink
fix: prefix match error (#224)
Browse files Browse the repository at this point in the history
* fix prefix match error

* fix bug

---------

Co-authored-by: lihan <[email protected]>
  • Loading branch information
zhylmzr and aooohan authored Apr 22, 2024
1 parent 80cdfd7 commit ae54645
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,12 @@ func (b *Sdk) PreUse(version Version, scope UseScope) (Version, error) {
installedVersions = append(installedVersions, string(sdk.Main.Version))
}
sort.Sort(installedVersions)
prefix := string(version) + "."
prefix := string(version)
for _, v := range installedVersions {
if prefix == v {
newVersion = Version(v)
break
}
if strings.HasPrefix(v, prefix) {
newVersion = Version(v)
break
Expand Down

0 comments on commit ae54645

Please sign in to comment.