modernize: Prefer strings.SplitSeq instead of Split

Avoids extra allocations. Added in Go 1.24.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-12-15 17:53:59 +01:00
parent c9b0a21bb1
commit a25907b485
29 changed files with 50 additions and 50 deletions

View File

@@ -361,8 +361,8 @@ func parseInitVersion(v string) (version string, commit string, _ error) {
// commit: 69663f0bd4b60df09991c08812a60108003fa340
// spec: 1.0.0
func parseRuntimeVersion(v string) (runtime, version, commit string, _ error) {
lines := strings.Split(strings.TrimSpace(v), "\n")
for _, line := range lines {
lines := strings.SplitSeq(strings.TrimSpace(v), "\n")
for line := range lines {
if strings.Contains(line, "version") {
s := strings.Split(line, "version")
runtime = strings.TrimSpace(s[0])