I am vendoring nakama-common locally
My go.mod looks like this:
go 1.15
require github.com/heroiclabs/nakama-common v1.10.0
I run go mod vendor
My go version matches: (1.15.5)
$> go version
go version go1.15.5 darwin/amd64
I am building on a remote linux machine using a Dockerfile:
FROM heroiclabs/nakama-pluginbuilder:2.15.0
…
RUN GO111MODULE=on CGO_ENABLED=1 GOOS=linux go build -v -buildmode=plugin -mod=vendor
When running nakama server 2.15.0, I indeed see "runtime":"go1.15.5"
But also plugin was built with a different version of package internal/unsafeheader
As far as I know, this error only occurs when the go versions don’t match up somewhere. But it seems this isn’t the case
@pahdo You must use the -trimpath flag when you build your Go code otherwise the Go binaries will include full system path labels inside the runtime metadata which appears as the same error as when you use different versions of the Go runtime. They resolve to the same root problem; the toolchain thinks the Go runtimes bundled in the game server and the plugin are different.
I recommend you use this gist as a guide for how to set up a local development environment based on a Docker multi-stage build:
@pahdo No worries. I’m happy its sorted. There’s some arcane history behind why the Go team added the -trimpath flag to the compiler but in essense its because this issue has never been resolved: