github-vet / github-vet/rangeloop-pointer-findings
staaldraad/ssh-git-go: main.go; 19 LoC
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 0
- Forks
- 0
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Found a possible issue in [staaldraad/ssh-git-go](https://www.github.com/staaldraad/ssh-git-go) at [main.go](https://github.com/staaldraad/ssh-git-go/blob/ac6aadc658281404fecbbd57249a03e7cb0ba515/main.go#L113-L131)
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 req used in defer or goroutine at line 123
[Click here to see the code in its original context.](https://github.com/staaldraad/ssh-git-go/blob/ac6aadc658281404fecbbd57249a03e7cb0ba515/main.go#L113-L131)
Click here to show the 19 line(s) of Go which triggered the analyzer.
```go
for req := range requests {
// only going to respond to exec.
// and then only to git-upload-pack
if req.Type == "exec" {
if req.WantReply {
req.Reply(true, []byte{})
}
go func() {
handleExecChannel(channel, req)
channel.Close()
}()
} else {
if req.WantReply {
req.Reply(false, nil)
}
}
}
```
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: ac6aadc658281404fecbbd57249a03e7cb0ba515
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Überprüfe main.go, Zeilen 113–131, sowie die Analyzer-Warnung dazu, dass die range-loop-Variable req in einer goroutine verwendet wird. Bestimme, ob die gemeldete Erfassung ein Fehler, abgemildert oder gewünschtes Verhalten ist, und hinterlasse anschließend die entsprechende Reaktion auf dem Issue; der Abschluss wird durch diese Klassifizierung erfasst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- go
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100