Skip to content

Commit

Permalink
internal/toolversions: use strings.Fields()
Browse files Browse the repository at this point in the history
  • Loading branch information
DeedleFake committed Dec 15, 2024
1 parent b80ca3e commit b0b6193
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions internal/toolversions/toolversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit b0b6193

Please sign in to comment.