-
I’ve started a project of making a small web-based game using the Go programming language, and I’m having a surprisingly hard time wrapping my head around it!
I’ve used Go before, but it was always for really straightforward API stuff (receive request, maybe update database, return response), and I never took the time to learn the language properly.
I’m using more of the language now, and keep shooting myself in the foot with it! Goroutines and channels are really cool, but using a language where asynchronicity is core part of the design is breaking my brain a bit.
For example, I accidentally called a function that waits on a timer without wrapping it in a goroutine, and in doing so, blocked all outgoing websocket messages for my player. It wasn’t immediately clear to me that the function was blocking, and so it took me a while to figure out what was going on.
I’ve been programming “inside my wheelhouse” with the same similar-ish languages (Javascript, Java, Python etc) for so long that I’m not used to making so many mistakes while coding!
Here’s hoping it gets easier as I build up intuition for it :)
Discuss on Mastodon