From b7f292743befbfe9395410be5a67f40d86c98a73 Mon Sep 17 00:00:00 2001 From: Evsyukov Denis Date: Thu, 7 Dec 2023 10:40:27 +0300 Subject: [PATCH] feat: do not use slices package for currentVersion --- gobrew.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gobrew.go b/gobrew.go index 58d9565..0882813 100644 --- a/gobrew.go +++ b/gobrew.go @@ -11,7 +11,6 @@ import ( "path/filepath" "regexp" "runtime" - "slices" "sort" "strconv" "strings" @@ -434,8 +433,8 @@ func (gb *GoBrew) CurrentVersion() string { version := strings.TrimSuffix(fp, strings.Join([]string{"go", "bin"}, string(os.PathSeparator))) paths := strings.Split(version, string(os.PathSeparator)) - slices.Reverse(paths) - for _, version = range paths { + for i := len(paths) - 1; i > 0; i-- { + version = paths[i] if version != "" { break }