github-vet / github-vet/rangeloop-pointer-findings
criticalstack/swoll: cmd/client.go; 25 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [criticalstack/swoll](https://www.github.com/criticalstack/swoll) at [cmd/client.go](https://github.com/criticalstack/swoll/blob/3116e3e24b1c8421cef7ec0e77a1393d18a5382a/cmd/client.go#L256-L280)
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 ep used in defer or goroutine at line 269
[Click here to see the code in its original context.](https://github.com/criticalstack/swoll/blob/3116e3e24b1c8421cef7ec0e77a1393d18a5382a/cmd/client.go#L256-L280)
Click here to show the 25 line(s) of Go which triggered the analyzer.
```go
for _, ep := range endpoints {
trace, err := ep.CreateTrace(ctx, jobid, ns, &traceSpec)
if err != nil {
log.Fatal(err)
}
log.Printf("Endpoint %s:%d created %s\n", ep.Hostname, ep.Port, trace.Status.JobID)
// if oneshot is enabled we also start reading from the job, and
// delete it once we are done.
if oneshot {
wg.Add(1)
go func() {
if err := ep.ReadTraceJob(ctx, trace.Status.JobID, outChan, stpChan); err != nil {
log.Println("Error reading", err)
}
if err := ep.DeleteTraceJob(ctx, trace.Status.JobID); err != nil {
log.Println("Error deleting", err)
}
wg.Done()
}()
}
}
```
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: 3116e3e24b1c8421cef7ec0e77a1393d18a5382a
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.