github-vet / github-vet/rangeloop-pointer-findings
luokeychen/uct-core: scrapers/njit/main.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [luokeychen/uct-core](https://www.github.com/luokeychen/uct-core) at [scrapers/njit/main.go](https://github.com/luokeychen/uct-core/blob/6d398fe1a76ba4fbef32aae7a3d0d041664289f7/scrapers/njit/main.go#L78-L99)
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.
> range-loop variable semester used in defer or goroutine at line 91
[Click here to see the code in its original context.](https://github.com/luokeychen/uct-core/blob/6d398fe1a76ba4fbef32aae7a3d0d041664289f7/scrapers/njit/main.go#L78-L99)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for _, semester := range semesters {
CreateCookieQueue(parseSemester(*semester))
subjectRequest := subjectRequest{semester: *semester, paginated: paginated{offset: 1, max: 10}}
subjects := subjectRequest.requestSubjects()
var wg sync.WaitGroup
control := make(chan struct{}, 10)
wg.Add(len(subjects))
for i := range subjects {
control <- struct{}{}
go func(subjects *NSubject) {
defer func() { wg.Done() }()
courseRequest := courseRequest{semester: *semester, subject: subjects.Code, paginated: paginated{offset: 0, max: 20}}
subjects.courses = courseRequest.requestSearch()
<-control
}(subjects[i])
}
wg.Wait()
university.Subjects = append(university.Subjects, buildSubjects(subjects)...)
}
```
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: 6d398fe1a76ba4fbef32aae7a3d0d041664289f7
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.