3 ms·
> You don't need something as powerful as Copilot for that kind of boilerplate though, there have been "snippets" / macro things for that for forever. I'm not
by cube2222 4y ago
> You don't need something as powerful as Copilot for that kind of boilerplate though, there have been "snippets" / macro things for that for forever.
I'm not aware of anything else that writes good wrapping error messages automatically though.
Your use-case is precisely what you'd be using generics / standard codegen for.
- sanderjd 4y agoInteresting, it's the error messages themselves that it's good for, rather than the boilerplate; I assumed you just meant the boilerplate around the error message. That kind of surprises me, but I guess I shouldn't be shocked that people are handling the same errors with the same messages over and over again without any way to encapsulate the pattern. Not shocked I guess, but that is disappointing.
- cube2222 4y agoThat's the point, it's not the same messages. Each error wrap has a situation-dependent wrapping message, different for each wrapped error in the function. Copilot is great at writing the whole `if err != nil`, including context-specific wrapping messages. It's also great at writing your code in many other situations where the intent is clear and simple, but it just takes a few lines to write in Go. I'm not sure if you've ever used Copilot yourself, but it's basically autocomplete on steroids.
- sanderjd 4y agoYes, the point I was trying to make is that it works because the error messages are formulaic. In which case I think it's too bad the whole pattern can't be abstracted.