github-vet / github-vet/rangeloop-pointer-findings

maciekmm/hackathon-uek-platforma-backend: timetable/coordinator.go; 32 LoC

Open
#12,445 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [maciekmm/hackathon-uek-platforma-backend](https://www.github.com/maciekmm/hackathon-uek-platforma-backend) at [timetable/coordinator.go](https://github.com/maciekmm/hackathon-uek-platforma-backend/blob/b59518bd5bad0b97ad4a22a1e78cd80f1a139259/timetable/coordinator.go#L181-L212)

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 group was used in a composite literal at line 201

[Click here to see the code in its original context.](https://github.com/maciekmm/hackathon-uek-platforma-backend/blob/b59518bd5bad0b97ad4a22a1e78cd80f1a139259/timetable/coordinator.go#L181-L212)

Click here to show the 32 line(s) of Go which triggered the analyzer.

```go
for _, group := range res {
c.Logger.Printf("checking plan updates for %d-%d\n", group, 3)
old, cached, err := c.Load(group, 3, false)
if err != nil {
c.Logger.Printf("could not fetch and parse timetable for group: %d, period: %d, err: %s\n", group, 3, err.Error())
continue
}
if !cached {
continue
}
new, _, err := c.Load(group, 3, true)
if err != nil {
c.Logger.Printf("could not fetch and parse timetable for group: %d, period: %d, err: %s\n", group, 3, err.Error())
continue
}
diff := old.Diff(*new)
pri := models.EventPriorityHigh
if len(diff) > 0 {
c.Logger.Printf("changes detected in %d-%d\n", group, 3)
event := &models.Event{
Group: &group,
Name: "Zmiana w planie zajęć!",
NotificationMessage: "Zapoznaj się z nowym planem zajęć.",
Description: diff.String(),
Priority: &pri,
}
if err := event.Add(c.Database, c.EventPipe); err != nil {
c.Logger.Printf("could not send timetable diff: %s", err.Error())
}
}
time.Sleep(1 * time.Second)
}

```

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: b59518bd5bad0b97ad4a22a1e78cd80f1a139259

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.