|
|
|
|
|
by __turbobrew__
951 days ago
|
|
I don’t really buy the usefulness of trying to statically detect possible nil panics. In their example of a service panicing 3000+ times a day why didn’t they just check the logs to get the stack trace of the panic and fix it there? I don’t see why static analysis was needed to fix that panic in runtime. What I would really like golang to have is way to send a “last gasp” packet to notify some other system that the runtime is panicing. Ideally at large scales it would be really nice to see what is panicing where and at what time with also stack traces and maybe core dumps. I think that would be much more useful for fixing panics in production. There was a proposal to add this to the runtime, but it got turned down: https://github.com/golang/go/issues/32333
Most of the arguments against the proposal seem to be that it is hard to determine what is safe to run in a global panic handler. I think the more reasonable option is to tell the go runtime that you want it to send a UDP packet to some address when it panics. That allows the runtime to not support calling arbitrary functions during panicing as it only has to send a UDP packet and then crash. I could see the static analyzer being useful for helping prevent the introduction of new panics, but I would much rather have better runtime detection. |
|
I tried this with a medium sized project and some unexpected code that could panic 3 functions away from the nil.