github-vet / github-vet/rangeloop-pointer-findings
tesujiro/olion2: olion.go; 24 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [tesujiro/olion2](https://www.github.com/tesujiro/olion2) at [olion.go](https://github.com/tesujiro/olion2/blob/0aaecb72a1def0ee1a07c89e983845d29f6f47f6/olion.go#L208-L231)
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.
>
[Click here to see the code in its original context.](https://github.com/tesujiro/olion2/blob/0aaecb72a1def0ee1a07c89e983845d29f6f47f6/olion.go#L208-L231)
Click here to show the 24 line(s) of Go which triggered the analyzer.
```go
for _, flying := range flyings {
upMsg := <-flying.upCh()
upMsgs = append(upMsgs, upMsg)
// Throw a bomb from enemy.
if !flying.isExploding() && flying.hasBomb() && state.screen.distance(flying.getPosition(), Coordinates{}) < flying.getThrowBombDistance() {
sp1 := state.speed
position := flying.getPosition()
distance := state.screen.distance(position, Coordinates{})
debug.Printf("Enemy Bomb!! self=%v speed=%v position=%v distance=%v\n", &flying, sp1, position, distance)
k := 0
if position.Z != 0 {
//k = distance * 80 * 1000 / position.Z
k = distance * 80 / position.Z // 80 : z axis speed of enemy bombs
}
//speed := Coordinates{X: -position.X*k/distance/1000 + sp1.X, Y: -position.Y*k/distance/1000 + sp1.Y, Z: -position.Z*k/distance/1000 + sp1.Z}
speed := position.ScaleBy(-k).Div(distance).Add(sp1)
//debug.Printf("speed=%v\n", speed)
newObj := newEnemyBomb(now, 1000, position, speed)
newObj.setBomber(flying)
state.space.AddObj(newObj)
flying.removeBomb()
}
// Todo:敵同士の攻撃
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {Printf 5} was not found in the callgraph; reference was passed directly to third-party code
```
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: 0aaecb72a1def0ee1a07c89e983845d29f6f47f6
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.