How to create a uuidV4 server side using Go?

How do I create a UUID server side using GoLang ? Is there a GoLang API reference anywhere so I don’t have to keep posting questions here ?

Hi @Spuddy - You can find the Go reference here for future use.

For your immediate question, you can create one via the included uuid package:

id := uuid.NewV4()

@gabriel - "github.com/gofrs/uuid" in the import section adds the package but when I create docker container thing, I get an error: plugin was built with a different version of package github.com/gofrs/uuid"} I’m too new to Nakama and GoLang to understand what I need to do to fix this. Can you help ?

@Spuddy Seems you’re using a different version of the uuid package than Nakama was compiled with.

Check out the guide here for this specific issue.

I would also recommend reading and following our guide on getting started with the Go runtime: Heroic Labs Documentation | Go Runtime.

I’ve finally managed to fix this so I’ll just write a few notes in case anyone else has the same or similar problem:

So the problem was that my go.mod file was set to require v4.4.0 of uuid: github.com/gofrs/uuid v4.4.0+incompatible and Nakama was built using a different version. I didn’t know how to find out what version of uuid Nakama was built with so I downloaded the Nakama source code from https://github.com/heroiclabs/nakama/releases and looked in the go.mod file and Nakama 3.16.0 uses github.com/gofrs/uuid v4.3.0+incompatible so I changed my go.mod file to match that version and typed go mod tidy to download the 4.3.0 package and go mod vendor for good luck and that fixed the problem.