github-vet / github-vet/rangeloop-pointer-findings
openziti/ziti: ziti-fabric-test/subcmd/loop2/dialer.go; 49 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [openziti/ziti](https://www.github.com/openziti/ziti) at [ziti-fabric-test/subcmd/loop2/dialer.go](https://github.com/openziti/ziti/blob/06c82fec2c13f8e08c5ccdf386a624a07052393a/ziti-fabric-test/subcmd/loop2/dialer.go#L88-L136)
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 conn used in defer or goroutine at line 116
[Click here to see the code in its original context.](https://github.com/openziti/ziti/blob/06c82fec2c13f8e08c5ccdf386a624a07052393a/ziti-fabric-test/subcmd/loop2/dialer.go#L88-L136)
Click here to show the 49 line(s) of Go which triggered the analyzer.
```go
for i, conn := range conns {
name := fmt.Sprintf("%s:%d", workload.Name, i)
resultCh := make(chan *loop2_pb.Result, 1)
resultChs[name] = resultCh
go func() {
workload := scenario.Workloads[0]
local := &loop2_pb.Test{
Name: name,
TxRequests: workload.Dialer.TxRequests,
TxPacing: workload.Dialer.TxPacing,
TxMaxJitter: workload.Dialer.TxMaxJitter,
RxRequests: workload.Listener.TxRequests,
RxTimeout: workload.Dialer.RxTimeout,
PayloadMinBytes: workload.Dialer.PayloadMinBytes,
PayloadMaxBytes: workload.Dialer.PayloadMaxBytes,
}
remote := &loop2_pb.Test{
Name: name,
TxRequests: workload.Listener.TxRequests,
TxPacing: workload.Listener.TxPacing,
TxMaxJitter: workload.Listener.TxMaxJitter,
RxRequests: workload.Dialer.TxRequests,
RxTimeout: workload.Listener.RxTimeout,
PayloadMinBytes: workload.Listener.PayloadMinBytes,
PayloadMaxBytes: workload.Listener.PayloadMaxBytes,
}
if proto, err := newProtocol(conn); err == nil {
if err := proto.txTest(remote); err == nil {
if err := proto.run(local); err == nil {
if result, err := proto.rxResult(); err == nil {
resultCh <- result
} else {
panic(err)
}
} else {
panic(err)
}
} else {
panic(err)
}
} else {
panic(err)
}
}()
time.Sleep(time.Duration(scenario.ConnectionDelay) * time.Millisecond)
}
```
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: 06c82fec2c13f8e08c5ccdf386a624a07052393a
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.