From 32b40deb465cfaae6ca9e4ab41ef5e597e36cb02 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 5 Nov 2024 10:09:37 +0100 Subject: [PATCH] cli/command/service: remove redundant capturing of loop vars (copyloopvar) go1.22 and up now produce a unique variable in loops, tehrefore no longer requiring to capture the variable manually; cli/command/service/update.go:1061:3: The copy of the 'for' variable "entry" can be deleted (Go 1.22+) (copyloopvar) entry := entry ^ cli/command/service/update.go:1089:4: The copy of the 'for' variable "port" can be deleted (Go 1.22+) (copyloopvar) port := port ^ Signed-off-by: Sebastiaan van Stijn --- cli/command/service/update.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cli/command/service/update.go b/cli/command/service/update.go index d8f89185ae..811dcf22b3 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -1058,7 +1058,6 @@ func updatePorts(flags *pflag.FlagSet, portConfig *[]swarm.PortConfig) error { // Build the current list of portConfig for _, entry := range *portConfig { - entry := entry if _, ok := portSet[portConfigToString(&entry)]; !ok { portSet[portConfigToString(&entry)] = entry } @@ -1086,7 +1085,6 @@ portLoop: ports := flags.Lookup(flagPublishAdd).Value.(*opts.PortOpt).Value() for _, port := range ports { - port := port if _, ok := portSet[portConfigToString(&port)]; ok { continue }