Live data from Hacker News

NilAway: Practical nil panic detection for Go

uber.com

1–10 of 262 posts

Re: NilAway: Practical nil panic detection for Go

#2
cool... what does this mean the best linter / correctness checking is at the moment?

I have some code that eventually core dumps and honestly I don't know what I'm doing wrong, and neither do any golang tools I've tried :(

maaaaaybe there's something that'll check that your code never closes a channel or always blocks after a specific order of events happens...

Re: NilAway: Practical nil panic detection for Go

#3
> Nil panics are found to be an especially pervasive form of runtime errors in Go programs. Uber’s Go monorepo is no exception to this, and has witnessed several runtime errors in production because of nil panics, with effects ranging from incorrect program behavior to app outages, affecting Uber customers.

Insane that Go had decades of programming mistakes to learn from but it chose this path.

Anyway, at least Uber is out there putting out solid bandaids. Their equivalent for Java is definitely a must-have for any project.

Re: NilAway: Practical nil panic detection for Go

#4

> Nil panics are found to be an especially pervasive form of runtime errors in Go programs. Uber’s Go monorepo is no exception to this, and has witnessed several runtime errors in production because of nil panics, with effects ranging from incorrect program behavior to app outages, affecting Uber customers. Insane that Go had decades of programming mistakes to learn from but it chose this path. Anyway, at least Uber…

[deleted]

Re: NilAway: Practical nil panic detection for Go

#5

> Nil panics are found to be an especially pervasive form of runtime errors in Go programs. Uber’s Go monorepo is no exception to this, and has witnessed several runtime errors in production because of nil panics, with effects ranging from incorrect program behavior to app outages, affecting Uber customers. Insane that Go had decades of programming mistakes to learn from but it chose this path. Anyway, at least Uber…

The go version NilAway isn’t as good as the java version NullAway yet. But the team working on it is very responsive and eager to improve.

For java projects I think NullAway has gotten so good that it really takes the steam out of the Kotlin proponents. Hopefully NilAway will get there too.

Re: NilAway: Practical nil panic detection for Go

#6

cool... what does this mean the best linter / correctness checking is at the moment? I have some code that eventually core dumps and honestly I don't know what I'm doing wrong, and neither do any golang tools I've tried :( maaaaaybe there's something that'll check that your code never closes a channel or always blocks after a specific order of events happens...

I don't think a pure Go program can core dump, unless you use Cgo (wrongly) or unsafe. It can only panic.

Re: NilAway: Practical nil panic detection for Go

#7

cool... what does this mean the best linter / correctness checking is at the moment? I have some code that eventually core dumps and honestly I don't know what I'm doing wrong, and neither do any golang tools I've tried :( maaaaaybe there's something that'll check that your code never closes a channel or always blocks after a specific order of events happens...

I don't think a pure Go program can core dump, unless you use Cgo (wrongly) or unsafe. It can only panic.

Races between goroutines can corrupt memory. E.g. manipulate a map from two goroutines and you can wreck its internal state.

Re: NilAway: Practical nil panic detection for Go

#8

> Nil panics are found to be an especially pervasive form of runtime errors in Go programs. Uber’s Go monorepo is no exception to this, and has witnessed several runtime errors in production because of nil panics, with effects ranging from incorrect program behavior to app outages, affecting Uber customers. Insane that Go had decades of programming mistakes to learn from but it chose this path. Anyway, at least Uber…

> Insane that Go had decades of programming mistakes to learn from but it chose this path.

Yup, every time I write some Go I feel like it's been made in a vaccum, ignoring decades of programming language. null/nil is a solved problem by languages with sum types like haskell and rust, or with quasi-sums like zig. It always feels like a regression when switching from rust to go.

Kudos to Uber for the tool, it looks amazing!

Re: NilAway: Practical nil panic detection for Go

#9
Very interesting work. I wonder what were the difficulties encountered. Aliasing? Variable reassignment wrt short declaration shadowing?

Hopefully with time, when exploring union types and perhaps a limited form of generalized subtyping (currently it's only interface types) we'll be able to deal with nil for good.

Nil is useful, as long as correctly reined in.

Re: NilAway: Practical nil panic detection for Go

#10

> Nil panics are found to be an especially pervasive form of runtime errors in Go programs. Uber’s Go monorepo is no exception to this, and has witnessed several runtime errors in production because of nil panics, with effects ranging from incorrect program behavior to app outages, affecting Uber customers. Insane that Go had decades of programming mistakes to learn from but it chose this path. Anyway, at least Uber…

> Insane that Go had decades of programming mistakes to learn from but it chose this path. Yup, every time I write some Go I feel like it's been made in a vaccum, ignoring decades of programming language. null/nil is a solved problem by languages with sum types like haskell and rust, or with quasi-sums like zig. It always feels like a regression when switching from rust to go. Kudos to Uber for the tool, it looks ama…

Dart made the same nullable mistake but actually managed to fix it, which is quite impressive.

Go is just obstinately living in the 90s. I guess that's not really a surprise. It's pretty much C but with great tooling.

Post reply on HN