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() {
|
for i, n := range copts.netMode.Value() {
|
||||||
|
n := n
|
||||||
if container.NetworkMode(n.Target).IsUserDefined() {
|
if container.NetworkMode(n.Target).IsUserDefined() {
|
||||||
hasUserDefined = true
|
hasUserDefined = true
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1004,6 +1004,7 @@ func updatePorts(flags *pflag.FlagSet, portConfig *[]swarm.PortConfig) error {
|
||||||
|
|
||||||
// Build the current list of portConfig
|
// Build the current list of portConfig
|
||||||
for _, entry := range *portConfig {
|
for _, entry := range *portConfig {
|
||||||
|
entry := entry
|
||||||
if _, ok := portSet[portConfigToString(&entry)]; !ok {
|
if _, ok := portSet[portConfigToString(&entry)]; !ok {
|
||||||
portSet[portConfigToString(&entry)] = entry
|
portSet[portConfigToString(&entry)] = entry
|
||||||
}
|
}
|
||||||
|
@ -1031,6 +1032,7 @@ portLoop:
|
||||||
ports := flags.Lookup(flagPublishAdd).Value.(*opts.PortOpt).Value()
|
ports := flags.Lookup(flagPublishAdd).Value.(*opts.PortOpt).Value()
|
||||||
|
|
||||||
for _, port := range ports {
|
for _, port := range ports {
|
||||||
|
port := port
|
||||||
if _, ok := portSet[portConfigToString(&port)]; ok {
|
if _, ok := portSet[portConfigToString(&port)]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue