Hacker News new | ask | show | jobs
by bogota 1329 days ago
Panic at compile and run time are two very different things. must will panic before you ship your code to production no should want to make panic at runtime look nice
1 comments

You are gravely mistaken. MustCompile* if it fails panics at runtime. Go doesn’t have a general purpose compile time execution feature.

That’s all Must does - is make runtime panic look nice.

* MustCompile if you are unfamiliar - the compile refers to the compilation of the regular expression - which is always done at runtime.

Ah yeah i was remembering wrong. I normally have this setup as a package level variable and then build and test. But yes its on the test that it’s actually caught