github-vet / github-vet/rangeloop-pointer-findings
jeffwilliams/squarify: squarify.go; 30 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [jeffwilliams/squarify](https://www.github.com/jeffwilliams/squarify) at [squarify.go](https://github.com/jeffwilliams/squarify/blob/f38712eec14ee636422305928e39bcc785cdf48d/squarify.go#L299-L328)
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.
> function call at line 303 may store a reference to a
[Click here to see the code in its original context.](https://github.com/jeffwilliams/squarify/blob/f38712eec14ee636422305928e39bcc785cdf48d/squarify.go#L299-L328)
Click here to show the 30 line(s) of Go which triggered the analyzer.
```go
for _, a := range areas {
if row.size() > 0 {
worstBefore := row.worst()
worstAfter := float64(0)
row.pushTemporarily(&a, func() {
worstAfter = row.worst()
})
if worstBefore < worstAfter {
// It's better to make a new row now.
// Output the current blocks and make a new row
offset, newBlocks := row.makeBlocks()
output(newBlocks)
if row.Dir == Vertical {
rowX += offset
freeWidth -= offset
} else {
rowY += offset
freeHeight -= offset
}
row = makeRow()
}
}
cp := &area{}
*cp = a
row.push(cp)
}
```
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: f38712eec14ee636422305928e39bcc785cdf48d
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.