github-vet / github-vet/rangeloop-pointer-findings
yuto1115/othello: cpu/search.go; 26 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [yuto1115/othello](https://www.github.com/yuto1115/othello) at [cpu/search.go](https://github.com/yuto1115/othello/blob/d432ad2a3196150f08d9d48fb43e35639af34b56/cpu/search.go#L77-L102)
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 pos used in defer or goroutine at line 92
[Click here to see the code in its original context.](https://github.com/yuto1115/othello/blob/d432ad2a3196150f08d9d48fb43e35639af34b56/cpu/search.go#L77-L102)
Click here to show the 26 line(s) of Go which triggered the analyzer.
```go
for _, pos := range choice {
var histories = make([]tools.History, 0, 32)
err := b.Place(pos, &histories)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
go func(nb tools.Board) {
nb.ChangePlayer()
//res := -lastEval(&nb, 1, EVAL, 0, false)
res := -Eval(&nb, EVAL)
if flag {
if res > mx {
mx = res
POS = pos
}
} else {
flag = true
mx = res
POS = pos
}
finished <- true
}(*b)
b.Reverse(histories)
}
```
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: d432ad2a3196150f08d9d48fb43e35639af34b56
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.