From b0b619334eab0e3d1db4c4bac9bf34beeab6b0f0 Mon Sep 17 00:00:00 2001 From: DeedleFake Date: Sat, 14 Dec 2024 23:46:39 -0500 Subject: [PATCH] internal/toolversions: use `strings.Fields()` --- internal/toolversions/toolversions.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/internal/toolversions/toolversions.go b/internal/toolversions/toolversions.go index 9fafacb..a69fd56 100644 --- a/internal/toolversions/toolversions.go +++ b/internal/toolversions/toolversions.go @@ -179,21 +179,10 @@ func findToolVersionsInContent(content, toolName string) (versions []string, fou func getAllToolsAndVersionsInContent(content string) (toolVersions []ToolVersions) { for _, line := range readLines(content) { - tokens := parseLine(line) + tokens := strings.Fields(line) newTool := ToolVersions{Name: tokens[0], Versions: tokens[1:]} toolVersions = append(toolVersions, newTool) } return toolVersions } - -func parseLine(line string) (tokens []string) { - for _, token := range strings.Split(line, " ") { - token = strings.TrimSpace(token) - if len(token) > 0 { - tokens = append(tokens, token) - } - } - - return tokens -}