github-vet / github-vet/rangeloop-pointer-findings
Azure/sonic-mgmt-common: translib/lldp_app.go; 26 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Azure/sonic-mgmt-common](https://www.github.com/Azure/sonic-mgmt-common) at [translib/lldp_app.go](https://github.com/Azure/sonic-mgmt-common/blob/86c110812583d0132d6504a1e74eb0337f521fde/translib/lldp_app.go#L326-L351)
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 enabled is reassigned at line 332
[Click here to see the code in its original context.](https://github.com/Azure/sonic-mgmt-common/blob/86c110812583d0132d6504a1e74eb0337f521fde/translib/lldp_app.go#L326-L351)
Click here to show the 26 line(s) of Go which triggered the analyzer.
```go
for capName, enabled := range capLst {
if capName == "Router" {
capInfo, err := ngInfo.Capabilities.NewCapability(6)
if err == nil {
ygot.BuildEmptyTree(capInfo)
capInfo.State.Name = 6
capInfo.State.Enabled = &enabled
}
} else if capName == "Repeater" {
capInfo, err := ngInfo.Capabilities.NewCapability(5)
if err == nil {
ygot.BuildEmptyTree(capInfo)
capInfo.State.Name = 5
capInfo.State.Enabled = &enabled
}
} else if capName == "Bridge" {
capInfo, err := ngInfo.Capabilities.NewCapability(3)
if err == nil {
ygot.BuildEmptyTree(capInfo)
capInfo.State.Name = 3
capInfo.State.Enabled = &enabled
}
} else {
}
}
```
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: 86c110812583d0132d6504a1e74eb0337f521fde
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.