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

ryzencool/huobisdk-go: main/main.go; 14 LoC

Open
#15,302 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [ryzencool/huobisdk-go](https://www.github.com/ryzencool/huobisdk-go) at [main/main.go](https://github.com/ryzencool/huobisdk-go/blob/eb8d008776af9330d40a4cb587ee0157e6cb80be/main/main.go#L73-L86)

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 v used in defer or goroutine at line 76

[Click here to see the code in its original context.](https://github.com/ryzencool/huobisdk-go/blob/eb8d008776af9330d40a4cb587ee0157e6cb80be/main/main.go#L73-L86)

Click here to show the 14 line(s) of Go which triggered the analyzer.

```go
for _, v := range mc.Place {
go func() {
for {
service.AutoPlace(hbsk, v)
}
}()
for i := 0; i < 3; i++ {
go func() {
for {
service.CancelOver30(hbsk, v.Symbol)
}
}()
}
}

```

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: eb8d008776af9330d40a4cb587ee0157e6cb80be

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect main/main.go at lines 73-86, starting with the range over mc.Place and the goroutines that use v. Check whether the reported range-loop capture is an actual bug in this context and whether any other issue is evident in the snippet. Done means classifying it as Bug, Mitigated, or Desirable Behavior and leaving the corresponding reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.