What can i do if i import a package that indirectly requires a different version of a package that nakama runtime uses?

Using Golang to build a plugin for the Nakama runtime server. I was importing a few different packages (namely spf13/viper), however, the import required a different version of the same package that the runtime server uses, resulting in dependency pinning issues.

more specifically, importing github.com/spf13/viper indirectly imports golang.org/x/sys v0.1.0. However, nakama v1.25.0 requires golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d.

I tried changing the x/sys import to be v0.0.0-20220610221304-9f5ed59c137d, however running go mod tidy reverts it back to the version that viper wants, v.0.1.0.

In this case, am i just unable to use the viper package? Is there anything i can do to still be able to use viper, or any other package that has the same dependencies as nakama?

  1. Versions: Nakama 3.14.0, Docker, nakama-common v1.25.0
  2. Server Framework Runtime language (If relevant) Go 1.19

error when using viper:

{"level":"fatal","ts":"2022-11-29T19:17:58.720Z","caller":"main.go:158","msg":"Failed initializing runtime modules","error":"plugin.Open(\"/nakama/data/modules/backend\"): plugin was built with a different version of package golang.org/x/sys/internal/unsafeheader"}

Hello @technicallyty, have you tried following the steps in our dependency pinning guide?

yes. in my case, the version is reverted when i run go mod tidy.

I this case I’m afraid you’ll have to downgrade the viper package to github.com/spf13/viper v1.3.2 which should be compatible with the sys package Nakama v3.14.0 transient dependencies require.