I updated my local setup to Nakama 3.9.0 via the Mac binary at https://github.com/heroiclabs/nakama/releases
and updated the common library to the recommended:
% env GO111MODULE=on go get "github.com/heroiclabs/nakama-common/runtime@v1.20.0"
% go mod vendor
% go build --trimpath --mod=vendor --buildmode=plugin -o foo.so
% cp foo.so ..../nakama-3.9.0/data/modules
When starting I however get:
...
{"level":"error","ts":"2021-11-04T10:29:15.799+0200","caller":"server/runtime_go.go:2492","msg":"Could not open Go module","path":".../nakama-3.9.0/data/modules/....so","error":"plugin.Open(\.../nakama-3.9.0/data/modules/foo.so\"): plugin was built with a different version of package google.golang.org/protobuf/internal/detrand"}
{"level":"error","ts":"2021-11-04T10:29:15.799+0200","caller":"server/runtime.go:585","msg":"Error initialising Go runtime provider","error":"plugin.Open(\".../nakama-3.9.0/data/modules/foo.so\"): plugin was built with a different version of package google.golang.org/protobuf/internal/detrand"}
{"level":"fatal","ts":"2021-11-04T10:29:15.799+0200","caller":"v3/main.go:146","msg":"Failed initializing runtime modules","error":"plugin.Open(\".../nakama-3.9.0/data/modules/foo.so\"): plugin was built with a different version of package google.golang.org/protobuf/internal/detrand"}
My go.mod
for the plugin looks like:
module towersnap
go 1.17
require (
github.com/golang/protobuf v1.5.0
github.com/heroiclabs/nakama-common v1.20.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
google.golang.org/protobuf v1.26.0
)
I removed a couple irrelevant modules. The protobuf and sync requirements are added automatically by Go based on resolved dependencies, I guess. I’m not too experienced with Go yet. If I remove all requirements except nakama-common
they get added back in at these versions.
Seems the server has somehow different versions than these?