This solution breaks Exalysis, and presumably now also go-analyzer. Here's the problem:
In examExtensiveForLoop, this code assumes that every for loop will have a condition:
if loop.Cond().FindFirstByName(paramName) != nil {
...
}
In this case, loop.Cond() is nil:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa0 pc=0x1466eed]
goroutine 1 [running]:
github.com/exercism/exalysis/track/raindrops.examExtensiveForLoop(0xc0000d0140, 0xc0001d20c0)
/Users/john/git/bitfield/exalysis/track/raindrops/raindrops.go:116 +0x16d
This solution breaks Exalysis, and presumably now also
go-analyzer. Here's the problem:In
examExtensiveForLoop, this code assumes that everyforloop will have a condition:In this case,
loop.Cond()is nil: