Writing unit tests is the worst part of my developer journey in Golang
It took me a while to get testing right in my first project but Go has really powerful testing chops. I'm starting to like test tables and you can easily debug test cases from VSCode.
With Go, there is no equivalent of PHPUnit or JUnit that allows to quickly mock any dependency.
I didn't know about mocking with testify. It seems to be working similarly to gomock.
The problem is that the mocks have to be generated manually and to be maintained along with your codebase.
Hi Boris, happy you're liking Go so far!
I think the best solution is validation. I used govalidator successfully in a project.
You can do stuff like:
It took me a while to get testing right in my first project but Go has really powerful testing chops. I'm starting to like test tables and you can easily debug test cases from VSCode.
testify seems nice, haven't tried it yet
A couple of posts about unit testing in Go that I read:
There are resources around, you just have to find them. A good place to start are the newsletters Golang Weekly and Master the World of Golang.
Ah ah yes. Naming it Go was a bad move, it's too late for that
Have fun!
I will have a look at govalidator.
I already use testify for assertions, but it's not designed for mocking.
Thanks for your support, I'll have a look at your resources!
What about this part of testify's documentation? github.com/stretchr/testify#mock-p...
It doesn't work?
I didn't know about mocking with testify. It seems to be working similarly to gomock.
The problem is that the mocks have to be generated manually and to be maintained along with your codebase.
Yeah, fortunately I don't use mocking that much
They should've just called it Gopher, like GopherCon right?