1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

daemon: S1033: unnecessary guard around call to delete (gosimple)

```
daemon/container_operations.go:787:2: S1033: unnecessary guard around call to delete (gosimple)
	if _, ok := container.NetworkSettings.Networks[n.ID()]; ok {
	^
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-10-13 22:10:24 +02:00
parent cba180cac9
commit 6d9c219c54
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 3 additions and 6 deletions

View file

@ -493,9 +493,7 @@ func findConfigurationConflicts(config map[string]interface{}, flags *pflag.Flag
if len(unknownKeys) > 0 { if len(unknownKeys) > 0 {
unknownNamedConflicts := func(f *pflag.Flag) { unknownNamedConflicts := func(f *pflag.Flag) {
if namedOption, ok := f.Value.(opts.NamedOption); ok { if namedOption, ok := f.Value.(opts.NamedOption); ok {
if _, valid := unknownKeys[namedOption.Name()]; valid { delete(unknownKeys, namedOption.Name())
delete(unknownKeys, namedOption.Name())
}
} }
} }
flags.VisitAll(unknownNamedConflicts) flags.VisitAll(unknownNamedConflicts)

View file

@ -784,9 +784,8 @@ func (daemon *Daemon) connectToNetwork(container *container.Container, idOrName
EndpointSettings: endpointConfig, EndpointSettings: endpointConfig,
IPAMOperational: operIPAM, IPAMOperational: operIPAM,
} }
if _, ok := container.NetworkSettings.Networks[n.ID()]; ok {
delete(container.NetworkSettings.Networks, n.ID()) delete(container.NetworkSettings.Networks, n.ID())
}
if err := daemon.updateEndpointNetworkSettings(container, n, ep); err != nil { if err := daemon.updateEndpointNetworkSettings(container, n, ep); err != nil {
return err return err