# Go plugin compilation issue with Nakama 3.9.0

**URL:** <https://forum.heroiclabs.com/t/go-plugin-compilation-issue-with-nakama-3-9-0/2059>\
**Category:** Local Setup\
**Created:** [November 4, 2021, 8:44am UTC](https://forum.heroiclabs.com/t/go-plugin-compilation-issue-with-nakama-3-9-0/2059 "2021-11-04T08:44:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chakie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/chakie/32/772_2.png) [@chakie](https://forum.heroiclabs.com/u/chakie)\
**Post date:** [November 4, 2021, 8:44am UTC](https://forum.heroiclabs.com/t/go-plugin-compilation-issue-with-nakama-3-9-0/2059/1 "2021-11-04T08:44:27Z")

</div>

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:

```auto
% 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:

```auto
...
{"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:

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

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [November 8, 2021, 3:18pm UTC](https://forum.heroiclabs.com/t/go-plugin-compilation-issue-with-nakama-3-9-0/2059/2 "2021-11-08T15:18:38Z")

</div>

@chakie I recommend you read through the [Go dependency pinning docs](https://heroiclabs.com/docs/nakama/server-framework/go-dependency-pinning/). This part is especially important in your case I think:

> Note
> 
> It may help you to identify the correct version of a transitive dependency to be pinned in your plugin `go.mod` file by searching Nakama’s `vendor/modules.txt` file and look for the package that lead to the error.

---

<div class="post-metadata">

**Author:** ![chakie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/chakie/32/772_2.png) [@chakie](https://forum.heroiclabs.com/u/chakie)\
**Post date:** [November 9, 2021, 8:06pm UTC](https://forum.heroiclabs.com/t/go-plugin-compilation-issue-with-nakama-3-9-0/2059/3 "2021-11-09T20:06:41Z")

</div>

Thank you @zyro , that fixed my build. I didn’t think about looking in your Git repo for what Nakama was using. TIL. 🙂

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [November 9, 2021, 9:08pm UTC](https://forum.heroiclabs.com/t/go-plugin-compilation-issue-with-nakama-3-9-0/2059/4 "2021-11-09T21:08:25Z")

</div>

@chakie No problem, glad it’s solved!

For future reference the best way to stay on top of this is to keep an eye on the [Nakama releases page](https://github.com/heroiclabs/nakama/releases). We call out dependency upgrades in the release notes, so you can use that as a cue to check your own dependency usage in case it needs changes. 👍

---

<div class="post-metadata">

**Author:** ![chakie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/chakie/32/772_2.png) [@chakie](https://forum.heroiclabs.com/u/chakie)\
**Post date:** [November 10, 2021, 8:53am UTC](https://forum.heroiclabs.com/t/go-plugin-compilation-issue-with-nakama-3-9-0/2059/5 "2021-11-10T08:53:58Z")

</div>

Yeah, I do check them thoroughly, as they mention the required Go and `nakama-common` versions. Having those correct had been enough so far, thus my panicked question.

---

<div class="post-metadata">

**Author:** ![mautoan11](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@mautoan11](https://forum.heroiclabs.com/u/mautoan11)\
**Post date:** [January 30, 2022, 3:19am UTC](https://forum.heroiclabs.com/t/go-plugin-compilation-issue-with-nakama-3-9-0/2059/6 "2022-01-30T03:19:10Z")

</div>

Hi @chakie , can you teach me how can you solve this problem, please?

---

<div class="post-metadata">

**Author:** ![chakie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/chakie/32/772_2.png) [@chakie](https://forum.heroiclabs.com/u/chakie)\
**Post date:** [January 30, 2022, 1:53pm UTC](https://forum.heroiclabs.com/t/go-plugin-compilation-issue-with-nakama-3-9-0/2059/7 "2022-01-30T13:53:10Z")

</div>

@mautoan11 What problem do you have? Do you use the same version of Go as mentioned in the release notes?
