Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Java has exceptions and can mock at runtime using reflection. Go is much worse. If you have glue code that calls 5 methods in sequence, you need to set up build rules to generate 5 mocks for the corresponding interfaces. And then if you’re like me, re-sync the editor so it picks up the generated symbols. Then you need to write 1 + 2 + 3 + 4 + 5 mock expectations for the 5 test cases to reach each error return branch. Oh and the mock expectation arguments are immune to automated refactoring because they’re all interface{}. So if you want to change the arguments of a method that’s implicated in a lot of test cases, lol good luck.

People get over this and even grow to appreciate it from the perspective of the production code, but from the unit testing side it’s been an unrelenting nightmare from the time I started using the language professionally ~10 years ago until we got Copilot.

It’s total slop. Perfect for the slop generating machine.



This is horrible, thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: