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

staaldraad/ssh-git-go: main.go; 19 LoC

Aperta
#17,543 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
fresh small
Lingua principale
Nessun dato sulla lingua
Stelle
0
Fork
0
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Esamina main.go, righe 113-131, e l’avviso dell’analizzatore relativo all’uso della variabile del ciclo range req in una goroutine. Determina se la cattura segnalata è un bug, è mitigata o costituisce un comportamento desiderabile, quindi lascia la reazione corrispondente sull’issue; il completamento viene registrato tramite tale classificazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
go
Ambito
tooling
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.