Remove redundant checks and intermediate variables.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -236,22 +236,16 @@ func (config *configuration) fromOptions(labels map[string]string) error {
|
| 236 | 236 |
|
| 237 | 237 |
// processIPAM parses v4 and v6 IP information and binds it to the network configuration |
| 238 | 238 |
func (config *configuration) processIPAM(ipamV4Data, ipamV6Data []driverapi.IPAMData) {
|
| 239 |
- if len(ipamV4Data) > 0 {
|
|
| 240 |
- for _, ipd := range ipamV4Data {
|
|
| 241 |
- s := &ipSubnet{
|
|
| 242 |
- SubnetIP: ipd.Pool.String(), |
|
| 243 |
- GwIP: ipd.Gateway.String(), |
|
| 244 |
- } |
|
| 245 |
- config.Ipv4Subnets = append(config.Ipv4Subnets, s) |
|
| 246 |
- } |
|
| 247 |
- } |
|
| 248 |
- if len(ipamV6Data) > 0 {
|
|
| 249 |
- for _, ipd := range ipamV6Data {
|
|
| 250 |
- s := &ipSubnet{
|
|
| 251 |
- SubnetIP: ipd.Pool.String(), |
|
| 252 |
- GwIP: ipd.Gateway.String(), |
|
| 253 |
- } |
|
| 254 |
- config.Ipv6Subnets = append(config.Ipv6Subnets, s) |
|
| 255 |
- } |
|
| 239 |
+ for _, ipd := range ipamV4Data {
|
|
| 240 |
+ config.Ipv4Subnets = append(config.Ipv4Subnets, &ipSubnet{
|
|
| 241 |
+ SubnetIP: ipd.Pool.String(), |
|
| 242 |
+ GwIP: ipd.Gateway.String(), |
|
| 243 |
+ }) |
|
| 244 |
+ } |
|
| 245 |
+ for _, ipd := range ipamV6Data {
|
|
| 246 |
+ config.Ipv6Subnets = append(config.Ipv6Subnets, &ipSubnet{
|
|
| 247 |
+ SubnetIP: ipd.Pool.String(), |
|
| 248 |
+ GwIP: ipd.Gateway.String(), |
|
| 249 |
+ }) |
|
| 256 | 250 |
} |
| 257 | 251 |
} |