github-vet / github-vet/rangeloop-pointer-findings
mkb218/opera-omnia: stream.go; 37 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [mkb218/opera-omnia](https://www.github.com/mkb218/opera-omnia) at [stream.go](https://github.com/mkb218/opera-omnia/blob/e304d3dea4c451426fc5a1b561e1fcad312f42df/stream.go#L73-L109)
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 ar is reassigned at line 90
[Click here to see the code in its original context.](https://github.com/mkb218/opera-omnia/blob/e304d3dea4c451426fc5a1b561e1fcad312f42df/stream.go#L73-L109)
Click here to show the 37 line(s) of Go which triggered the analyzer.
```go
for ar := range AudioQueue {
// log.Println("from AudioQueue", ar.artist, ar.title)
// f := File{ar.artist, ar.title, make([]byte,0)}
p, err := exec.LookPath("lame")
if err != nil {
log.Panic("no lame found! CAN'T STREAM. DYING.")
}
f := func() string {
listenlock.Lock()
defer listenlock.Unlock()
f := ar.artist + "-" + ar.title + strconv.Itoa(listen.Count) + ".mp3"
f = path.Join(dumppath, strings.Replace(f, "/", "_", -1))
listen.Count++
return f
}()
c := exec.Command(p, "--tt", ar.title + " mangled by Opera Omnia", "--ta", ar.artist, "-r", "--bitwidth", "16", "--big-endian", "-b", strconv.Itoa(bitrate), "--cbr", "--nohist", "--signed", "-s", "44.1", "-", f)
c.Stdin = &ar
c.Stdout = new(bytes.Buffer)
b := new(bytes.Buffer)
c.Stderr = b
err = c.Run()
if err != nil {
log.Println("encoding failed for",ar.artist, ar.title, ":(", err)
log.Println(string(b.Bytes()))
log.Println(string(b.Bytes()))
continue
}
// log.Println("dumpchan send")
func() {
playqlock.Lock()
defer playqlock.Unlock()
delete(playqueue, playq{ar.artist, ar.title, ""})
}()
dumpchan <- path.Base(f)
// log.Println("dumpchan sent")
}
```
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: e304d3dea4c451426fc5a1b561e1fcad312f42df
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.