mirror of https://github.com/docker/cli.git
Merge pull request #2175 from thaJeztah/pin_in_scope
parseNetworkOpts, updatePorts: pin variables in scope (scopelint)
This commit is contained in:
commit
6eee39df0c
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue