github-vet / github-vet/rangeloop-pointer-findings
kubernetes-sigs/aws-load-balancer-controller: pkg/ingress/model_builder.go; 35 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [kubernetes-sigs/aws-load-balancer-controller](https://www.github.com/kubernetes-sigs/aws-load-balancer-controller) at [pkg/ingress/model_builder.go](https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/9a4e14094d75d679b6ac9f02a873191cad693e10/pkg/ingress/model_builder.go#L227-L261)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
> reference to ingKey is reassigned at line 229
[Click here to see the code in its original context.](https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/9a4e14094d75d679b6ac9f02a873191cad693e10/pkg/ingress/model_builder.go#L227-L261)
Click here to show the 35 line(s) of Go which triggered the analyzer.
```go
for ingKey, cfg := range listenPortConfigByIngress {
if mergedProtocolProvider == nil {
mergedProtocolProvider = &ingKey
mergedProtocol = cfg.protocol
} else if mergedProtocol != cfg.protocol {
return listenPortConfig{}, errors.Errorf("conflicting protocol, %v: %v | %v: %v",
*mergedProtocolProvider, mergedProtocol, ingKey, cfg.protocol)
}
if len(cfg.inboundCIDRv4s) != 0 || len(cfg.inboundCIDRv6s) != 0 {
cfgInboundCIDRv4s := sets.NewString(cfg.inboundCIDRv4s...)
cfgInboundCIDRv6s := sets.NewString(cfg.inboundCIDRv6s...)
if mergedInboundCIDRsProvider == nil {
mergedInboundCIDRsProvider = &ingKey
mergedInboundCIDRv4s = cfgInboundCIDRv4s
mergedInboundCIDRv6s = cfgInboundCIDRv6s
} else if !mergedInboundCIDRv4s.Equal(cfgInboundCIDRv4s) ||
!mergedInboundCIDRv6s.Equal(cfgInboundCIDRv6s) {
return listenPortConfig{}, errors.Errorf("conflicting inbound-cidrs, %v: %v, %v | %v: %v, %v",
*mergedInboundCIDRsProvider, mergedInboundCIDRv4s.List(), mergedInboundCIDRv6s.List(), ingKey, cfgInboundCIDRv4s.List(), cfgInboundCIDRv6s.List())
}
}
if cfg.sslPolicy != nil {
if mergedSSLPolicyProvider == nil {
mergedSSLPolicyProvider = &ingKey
mergedSSLPolicy = cfg.sslPolicy
} else if awssdk.StringValue(mergedSSLPolicy) != awssdk.StringValue(cfg.sslPolicy) {
return listenPortConfig{}, errors.Errorf("conflicting sslPolicy, %v: %v | %v: %v",
*mergedSSLPolicyProvider, awssdk.StringValue(mergedSSLPolicy), ingKey, awssdk.StringValue(cfg.sslPolicy))
}
}
mergedTLSCerts.Insert(cfg.tlsCerts...)
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 9a4e14094d75d679b6ac9f02a873191cad693e10
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.