3 ms·
The kubernetes ecosystem has a lot of go code which consequentially suffer from nil panics. Thankfully they recover otherwise we'd see an absolute shit ton of p
by gopher_1234 4y ago
The kubernetes ecosystem has a lot of go code which consequentially suffer from nil panics. Thankfully they recover otherwise we'd see an absolute shit ton of pod restarts.
In general, please stop panicking in library Go and Rust code. It's rude.
- rand0m4r 4y agoTotally agree, panic in a library is a smell
- jrockway 4y agonil panics are hard bugs, not stylistic concerns. There is never an occasion where correct code dereferences a nil pointer. The style point that people are missing here is that every type should have a usable zero value. If (&SomeStruct{}).Method() panics, that's an API design flaw.
- selfmodruntime 4y agoYes! This is one of the tiny few things I don‘t like about rust. In a language so focused on safety, why can anything panic? Every single failable function should return result. No ifs or buts.