# Plugin was built with a different version of package internal/unsafeheader

**URL:** <https://forum.heroiclabs.com/t/plugin-was-built-with-a-different-version-of-package-internal-unsafeheader/1210>\
**Category:** Local Setup\
**Tags:** server-framework\
**Created:** [December 7, 2020, 1:19am UTC](https://forum.heroiclabs.com/t/plugin-was-built-with-a-different-version-of-package-internal-unsafeheader/1210 "2020-12-07T01:19:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pahdo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/pahdo/32/418_2.png) [@pahdo](https://forum.heroiclabs.com/u/pahdo)\
**Post date:** [December 7, 2020, 1:19am UTC](https://forum.heroiclabs.com/t/plugin-was-built-with-a-different-version-of-package-internal-unsafeheader/1210/1 "2020-12-07T01:19:59Z")

</div>

I am aware of building with mismatched go versions described in:

[Problem with go runtime module](https://forum.heroiclabs.com/t/problem-with-go-runtime-module/672/2)

I am vendoring nakama-common locally  
My go.mod looks like this:

```auto
go 1.15

require github.com/heroiclabs/nakama-common v1.10.0

```

I run `go mod vendor`

My go version matches: (1.15.5)

```auto
$> 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

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [December 7, 2020, 1:29am UTC](https://forum.heroiclabs.com/t/plugin-was-built-with-a-different-version-of-package-internal-unsafeheader/1210/2 "2020-12-07T01:29:37Z")

</div>

@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:

[https://gist.github.com/novabyte/cc6d57022e2d3baa40e98d8fc91dc4c8](https://gist.github.com/novabyte/cc6d57022e2d3baa40e98d8fc91dc4c8)

Hope it helps.

---

<div class="post-metadata">

**Author:** ![pahdo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/pahdo/32/418_2.png) [@pahdo](https://forum.heroiclabs.com/u/pahdo)\
**Post date:** [December 7, 2020, 1:33am UTC](https://forum.heroiclabs.com/t/plugin-was-built-with-a-different-version-of-package-internal-unsafeheader/1210/3 "2020-12-07T01:33:55Z")

</div>

This was exactly it. Thank you so much

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [December 7, 2020, 1:37am UTC](https://forum.heroiclabs.com/t/plugin-was-built-with-a-different-version-of-package-internal-unsafeheader/1210/4 "2020-12-07T01:37:00Z")

</div>

@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:

[https://github.com/golang/go/issues/17150](https://github.com/golang/go/issues/17150)

However I’m glad they introduced that cmd flag in the meantime. 🙂
