github-vet / github-vet/rangeloop-pointer-findings
lc/secretz: main.go; 40 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [lc/secretz](https://www.github.com/lc/secretz) at [main.go](https://github.com/lc/secretz/blob/4d14ecd2a285085ebadfe5289fe3c38ab6c7189d/main.go#L99-L138)
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 org used in defer or goroutine at line 129
[Click here to see the code in its original context.](https://github.com/lc/secretz/blob/4d14ecd2a285085ebadfe5289fe3c38ab6c7189d/main.go#L99-L138)
Click here to show the 40 line(s) of Go which triggered the analyzer.
```go
for _, org := range targets {
lib.CreateOrg(org)
log.Printf("Fetching repos for %s\n", org)
ParseResponse(org)
log.Printf("Fetching builds for %s's repos\n", org)
jobChan := make(chan *Job)
finishedChan := make(chan string)
var wg, wg2 sync.WaitGroup
wg2.Add(1)
for i := 0; i < concurrency; i++ {
wg.Add(1)
go func() {
defer wg.Done()
SaveLogs(jobChan, finishedChan)
}()
}
go func() {
defer wg2.Done()
for str := range finishedChan {
log.Printf("%s\n", str)
}
}()
go func() {
for _, slug := range repos {
builds := GetBuilds(slug)
for _, job := range builds {
jobChan <- &Job{ID: job, Org: org}
}
}
close(jobChan)
}()
wg.Wait()
close(finishedChan)
wg2.Wait()
}
```
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: 4d14ecd2a285085ebadfe5289fe3c38ab6c7189d
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.