DEV Community

loading...

You Can't Write Carrier Grade Software in Go

jautero profile image Juha Autero ・1 min read

because it doesn't have assert.

Discussion (3)

pic
Editor guide
Collapse
curtisfenner profile image
Curtis Fenner

The lack of assert is definitely the strangest omission in Go to me. They say they didn't include it because they were afraid programmers would use it instead of handling error cases, but I have literally never seen code and thought this code has too many asserts. Most code needs a whole lot more asserts, really.

Collapse
jautero profile image
Juha Autero Author

The joke is that I've seen lot of "carrier grade" code that is basically

ptr=malloc(BYTES);
assert(ptr);
Collapse
curtisfenner profile image
Curtis Fenner

well, tripping an assert is at least better than memory corruption ¯\_(ツ)_/¯