Local Nakama Go runtime Setup / Testing

Hi! I’m new to Nakama/Go so forgive me if this has been addressed somewhere else.

I am trying to find the best way to write unit tests for custom RPCs. Which is the best way on doing it? I saw some docs about how to do it using Jest (TS runtime) but nothing for go. Are there examples of how to do it (mocking things, etc)? How can I run the tests? Is there any doc about it?

Another question is, is there a way to skip building the image and restart the container whenever I make some changes in Go (like nodemon in NodeJS)? Building and restarting takes a lot of time.


Hello @matiasvillanueva,

As suggested here you could use some Go library to generate the mocks and test your RPC functions. You’d run the tests using the regular go testing package and go test command.

The server does not support hot code reloading at this stage.


@sesposito this command

go:generate mockery --name NakamaInitializer --inpackage --with-expecter --case=underscore

It is not working for me, I tried with

go generate mockery --name NakamaInitializer --inpackage --with-expecter --case=underscore

But nothing happens…

I’ve not worked with these mock generators myself so unfortunately I cannot help you further, but perhaps someone else in the community may have some insight.

I suggest you ask in the other thread too so your question gets more visbility.


This is working for us:
//go:generate mockery --name NakamaModule --inpackage --with-expecter --case=underscore
type NakamaModule interface {

//go:generate mockery --name NakamaInitializer --inpackage --with-expecter --case=underscore
type NakamaInitializer interface {