github-vet / github-vet/rangeloop-pointer-findings
ZhuZhengyi/pd-go: cmd/upload.go; 11 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ZhuZhengyi/pd-go](https://www.github.com/ZhuZhengyi/pd-go) at [cmd/upload.go](https://github.com/ZhuZhengyi/pd-go/blob/6ab36f03571cc860be03e6f9bf309e9cb36d61fe/cmd/upload.go#L45-L55)
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 node used in defer or goroutine at line 48
[Click here to see the code in its original context.](https://github.com/ZhuZhengyi/pd-go/blob/6ab36f03571cc860be03e6f9bf309e9cb36d61fe/cmd/upload.go#L45-L55)
Click here to show the 11 line(s) of Go which triggered the analyzer.
```go
for _, node := range sshNodes {
wg.Add(1)
go func(host, src, tgt string) {
if err := node.Upload(host, src, tgt, optVerbose, 0755); err != nil {
fmt.Printf("%-16s[FAILED], err: \n", host, err)
} else {
fmt.Printf("%-16s[OK]\n", host)
}
wg.Done()
}(node.Host, optLocalPath, optRemotePath)
}
```
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: 6ab36f03571cc860be03e6f9bf309e9cb36d61fe
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.