@@ -12,12 +12,14 @@ import (
1212 "path/filepath"
1313 "regexp"
1414 "runtime"
15+ "slices"
1516 "sort"
1617 "strings"
1718
1819 "github.com/Masterminds/semver"
1920 "github.com/c4milo/unpackit"
2021 "github.com/gookit/color"
22+
2123 "github.com/kevincobain2000/gobrew/utils"
2224)
2325
@@ -269,6 +271,17 @@ func (gb *GoBrew) judgeVersion(version string) string {
269271 }
270272 }
271273
274+ exists := false
275+ for _ , value := range groupedVersions {
276+ if slices .Contains (value , version ) {
277+ exists = true
278+ break
279+ }
280+ }
281+ if ! exists {
282+ return NoneVersion
283+ }
284+
272285 return version
273286}
274287
@@ -350,7 +363,7 @@ func (gb *GoBrew) downloadAndExtract(version string) {
350363
351364 if err != nil {
352365 gb .cleanDownloadsDir ()
353- color .Infoln ("==> [Info ] Downloading version failed:" , err )
366+ color .Errorln ("==> [Error ] Downloading version failed:" , err )
354367 color .Errorln ("==> [Error]: Please check connectivity to url:" , downloadURL )
355368 os .Exit (1 )
356369 }
@@ -365,7 +378,7 @@ func (gb *GoBrew) downloadAndExtract(version string) {
365378 if err != nil {
366379 // clean up dir
367380 gb .cleanVersionDir (version )
368- color .Infoln ("==> [Info] Extract failed:" , err )
381+ color .Errorln ("==> [Info] Extract failed:" , err )
369382 os .Exit (1 )
370383 }
371384 color .Infoln ("==> [Success] Extract to" , gb .getVersionDir (version ))
@@ -452,7 +465,7 @@ func doRequest(url string) (data []byte) {
452465}
453466
454467func (gb * GoBrew ) extract (srcTar string , dstDir string ) error {
455- //#nosec G304
468+ // #nosec G304
456469 file , err := os .Open (srcTar )
457470 if err != nil {
458471 return err
0 commit comments