Skip to content

Commit

Permalink
Merge pull request coreybutler#1049 from Juneezee/master
Browse files Browse the repository at this point in the history
Avoid unnecessary byte/string conversion
  • Loading branch information
coreybutler authored Oct 10, 2023
2 parents 71713ec + 683357f commit a73ef54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ func uninstall(version string) {
func versionNumberFrom(version string) string {
reg, _ := regexp.Compile("[^0-9]")

if reg.Match([]byte(version[:1])) {
if reg.MatchString(version[:1]) {
if version[0:1] != "v" {
url := web.GetFullNodeUrl("latest-" + version + "/SHASUMS256.txt")
content := strings.Split(web.GetRemoteTextFile(url), "\n")[0]
Expand All @@ -529,7 +529,7 @@ func versionNumberFrom(version string) string {
}
}

for reg.Match([]byte(version[:1])) {
for reg.MatchString(version[:1]) {
version = version[1:]
}

Expand Down

0 comments on commit a73ef54

Please sign in to comment.