github-vet / github-vet/rangeloop-pointer-findings
battlesnakeio/engine: rules/api_client.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [battlesnakeio/engine](https://www.github.com/battlesnakeio/engine) at [rules/api_client.go](https://github.com/battlesnakeio/engine/blob/34dc951a74ec87b425ec25c19df9c9b32c59f3fc/rules/api_client.go#L74-L93)
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 snake used in defer or goroutine at line 87
[Click here to see the code in its original context.](https://github.com/battlesnakeio/engine/blob/34dc951a74ec87b425ec25c19df9c9b32c59f3fc/rules/api_client.go#L74-L93)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for _, snake := range snakes {
if !isValidURL(snake.URL) {
respChan <- snakeResponse{
snake: snake,
err: errors.New("invalid snake URL: " + snake.URL),
}
continue
}
wg.Add(1)
go func(s *pb.Snake, mr multiSnakeRequest) {
options := snakePostOptions{
url: mr.url,
snake: s,
timeout: mr.timeout,
}
getSnakeResponse(options, mr.game, mr.frame, respChan)
wg.Done()
}(snake, multiReq)
}
```
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: 34dc951a74ec87b425ec25c19df9c9b32c59f3fc
Contributor guide
No contributing guide indexed for this repository
Research direction
Read rules/api_client.go lines 74-93 and compare the analyzer warning with the goroutine call shown in the issue. No test is mentioned; finish by leaving the requested Bug, Mitigated, or Desirable Behavior reaction on the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100