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

hackclub/slash-z: zoom_machine.go; 60 LoC

Open
#16,902 0 comments 0 reactions 0 assignees View on GitHub
fresh medium
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [hackclub/slash-z](https://www.github.com/hackclub/slash-z) at [zoom_machine.go](https://github.com/hackclub/slash-z/blob/2d4baf45719141253aec8246ab317a1f5debf5b6/zoom_machine.go#L192-L251)

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.

>

[Click here to see the code in its original context.](https://github.com/hackclub/slash-z/blob/2d4baf45719141253aec8246ab317a1f5debf5b6/zoom_machine.go#L192-L251)

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

```go
for _, meeting := range meetings {
// if the meeting has users in it...
if meeting.CurrentActiveUsers > 0 {
// and it is currently set as an idle meeting..
if meeting.IdlingSince != nil {
// remove the idle status.
meeting.IdlingSince = nil

if m.dbc.UpdateMeeting(&meeting); err != nil {
return err
}
}

// and it is not currently idle, then ignore it
continue
}

// if meeting does not have users in it..

// and it's set to idle...
if meeting.IdlingSince != nil {
elapsed := time.Now().Sub(*meeting.IdlingSince)

fmt.Println(meeting.ZoomID, "has been idling for", elapsed)

// if it's been less than one minute, ignore
if elapsed.Minutes() < 1 {
continue
}

// Actually end the meeting with Zoom's API and update Slack too
if err := m.EndMeeting(meeting); err != nil {
return err
}

// else end the meeting
current := time.Now()
meeting.EndedAt = ¤t

if m.dbc.UpdateMeeting(&meeting); err != nil {
return err
}

continue
}

// and it's not set to idle...
if meeting.IdlingSince == nil {
// mark it as idle.
current := time.Now()
meeting.IdlingSince = ¤t

if m.dbc.UpdateMeeting(&meeting); err != nil {
return err
}

continue
}

}

```

Click here to show extra information the analyzer produced.

```
No path was found through the callgraph that could lead to a function which writes a pointer argument.

No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.

root signature {UpdateMeeting 1} was not found in the callgraph; reference was passed directly to third-party code
```

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: 2d4baf45719141253aec8246ab317a1f5debf5b6

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.