github-vet / github-vet/rangeloop-pointer-findings
zaklaus/rurik: src/system/assets.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [zaklaus/rurik](https://www.github.com/zaklaus/rurik) at [src/system/assets.go](https://github.com/zaklaus/rurik/blob/7232e10ab8df483f04fea1b6a37f099d3899488f/src/system/assets.go#L324-L345)
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.
> reference to v is reassigned at line 343
[Click here to see the code in its original context.](https://github.com/zaklaus/rurik/blob/7232e10ab8df483f04fea1b6a37f099d3899488f/src/system/assets.go#L324-L345)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for _, v := range db.Chunks {
var totalMatch float64
for x, t := range v.Tags {
a := float64(vec.Tags[t])
var neg float64 = 1
if a < 1 {
neg = -1
}
b := v.TagValues[x]
d0 := math.Abs(float64(a - b))
d1 := math.Abs((a - 1000000*neg) - b)
diff := 1 - math.Min(d0, d1)
w := vec.Weights[t] * diff
totalMatch += w
}
if bestMatch < totalMatch {
bestMatch = totalMatch
res = &v
}
}
```
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: 7232e10ab8df483f04fea1b6a37f099d3899488f
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.