From 648199b321f71c178042a8c29917c23621a0473b Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 29 Oct 2019 14:12:09 +0100 Subject: [PATCH 1/2] cli/command/service: Using a reference for the variable on range scope `entry` (scopelint) ``` cli/command/service/update.go:1007:43: Using a reference for the variable on range scope `entry` (scopelint) if _, ok := portSet[portConfigToString(&entry)]; !ok { ^ cli/command/service/update.go:1008:32: Using a reference for the variable on range scope `entry` (scopelint) portSet[portConfigToString(&entry)] = entry ^ cli/command/service/update.go:1034:44: Using a reference for the variable on range scope `port` (scopelint) if _, ok := portSet[portConfigToString(&port)]; ok { ^ ``` Signed-off-by: Sebastiaan van Stijn --- cli/command/service/update.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/command/service/update.go b/cli/command/service/update.go index c95dcf50d3..6578047cbe 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -1004,6 +1004,7 @@ 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 } @@ -1031,6 +1032,7 @@ portLoop: ports := flags.Lookup(flagPublishAdd).Value.(*opts.PortOpt).Value() for _, port := range ports { + port := port if _, ok := portSet[portConfigToString(&port)]; ok { continue } From 54411e5a92b17577bbfe204afcb0a88b7ee685b1 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 29 Oct 2019 14:15:29 +0100 Subject: [PATCH 2/2] cli/command/container: Using a reference for the variable on range scope `n` (scopelint) ``` cli/command/container/opts.go:700:37: Using a reference for the variable on range scope `n` (scopelint) if err := applyContainerOptions(&n, copts); err != nil { ^ ``` Signed-off-by: Sebastiaan van Stijn --- cli/command/container/opts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/command/container/opts.go b/cli/command/container/opts.go index 19a2d158cc..0615e1b556 100644 --- a/cli/command/container/opts.go +++ b/cli/command/container/opts.go @@ -686,6 +686,7 @@ func parseNetworkOpts(copts *containerOptions) (map[string]*networktypes.Endpoin ) for i, n := range copts.netMode.Value() { + n := n if container.NetworkMode(n.Target).IsUserDefined() { hasUserDefined = true } else {