github-vet / github-vet/rangeloop-pointer-findings
target/goalert: alert/log/store.go; 43 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [target/goalert](https://www.github.com/target/goalert) at [alert/log/store.go](https://github.com/target/goalert/blob/8f26be04a4df6f460334c4553f874e5a7c641fbe/alert/log/store.go#L463-L505)
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 e is reassigned at line 476
[Click here to see the code in its original context.](https://github.com/target/goalert/blob/8f26be04a4df6f460334c4553f874e5a7c641fbe/alert/log/store.go#L463-L505)
Click here to show the 43 line(s) of Go which triggered the analyzer.
```go
for _, e := range raw {
switch e.Type() {
case TypeCreated, TypeAcknowledged, TypeEscalationRequest, TypeEscalated:
// these are the ones we want to dedup
default:
if cur != nil {
result = append(result, *cur)
cur = nil
}
result = append(result, e)
continue
}
if cur == nil {
cur = &e
continue
}
if e.Type() != cur.Type() {
result = append(result, *cur)
cur = &e
continue
}
eSub := e.Subject()
if eSub == nil {
// no new subject info
continue
}
cSub := cur.Subject()
if cSub == nil {
// old one has none, new one does
cur = &e
continue
}
// both have subjects, only replace if the new one
// has a classifier
if eSub.Classifier != "" {
cur = &e
continue
}
}
```
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: 8f26be04a4df6f460334c4553f874e5a7c641fbe
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.