From acc45f5494b31bc10be445c9597b03d3061a453f Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 27 Dec 2022 17:44:01 +0100 Subject: [PATCH] cli/command/volume: use strings.Cut Signed-off-by: Sebastiaan van Stijn --- cli/command/volume/create.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/command/volume/create.go b/cli/command/volume/create.go index 6f89933597..a3219da92a 100644 --- a/cli/command/volume/create.go +++ b/cli/command/volume/create.go @@ -165,9 +165,9 @@ func runCreate(dockerCli command.Cli, options createOptions) error { // comma-separated list of equal separated maps segments := map[string]string{} for _, segment := range strings.Split(top, ",") { - parts := strings.SplitN(segment, "=", 2) // TODO(dperny): validate topology syntax - segments[parts[0]] = parts[1] + k, v, _ := strings.Cut(segment, "=") + segments[k] = v } topology.Requisite = append( topology.Requisite, @@ -180,9 +180,9 @@ func runCreate(dockerCli command.Cli, options createOptions) error { // comma-separated list of equal separated maps segments := map[string]string{} for _, segment := range strings.Split(top, ",") { - parts := strings.SplitN(segment, "=", 2) // TODO(dperny): validate topology syntax - segments[parts[0]] = parts[1] + k, v, _ := strings.Cut(segment, "=") + segments[k] = v } topology.Preferred = append(