mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
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:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user