# Unable to run the Go Modules example with Nakama 2.7

**URL:** <https://forum.heroiclabs.com/t/unable-to-run-the-go-modules-example-with-nakama-2-7/216>\
**Category:** Game Design\
**Tags:** getting-started\
**Created:** [September 19, 2019, 3:06pm UTC](https://forum.heroiclabs.com/t/unable-to-run-the-go-modules-example-with-nakama-2-7/216 "2019-09-19T15:06:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![igeorgievsd](https://avatars.discourse-cdn.com/v4/letter/i/96bed5/32.png) [@igeorgievsd](https://forum.heroiclabs.com/u/igeorgievsd)\
**Post date:** [September 19, 2019, 3:06pm UTC](https://forum.heroiclabs.com/t/unable-to-run-the-go-modules-example-with-nakama-2-7/216/1 "2019-09-19T15:06:50Z")

</div>

Hi,

I have recently tried to update to Nakama 2.7.0 to leverage the go 1.13 module support.  
I ran into an issue after building the Golang shared object and trying to start Nakama.

I experienced the problem in a slightly bigger code base and started stripping things down until I had the smallest possible reproduction.  
I got to the point where I made a new folder containing just the [minimal example](https://github.com/heroiclabs/nakama/tree/master/sample_go_module#minimal-example).

Environment:

- Windows 10 64bit
- Nakama 2.7.0
- Plugin build image: heroiclabs/nakama-pluginbuilder:2.7.0  
Command:  
_docker run --rm -v %cd%:/tempbuild -w /tempbuild heroiclabs/nakama-pluginbuilder:2.7.0 build --buildmode=plugin -trimpath -o ./modules/plugin\_project.so_
- Server running in standard docker-compose.yml with version 2.7.0 of Nakama

Issues

1. Using the 2.7.0 version of the plugin builder image I was unable to build the example out of the box. I believe this is due to commit [fe4f8f0aa40aae7a5ce378f9e1a8c13f9f978433](https://github.com/heroiclabs/nakama/commit/fe4f8f0aa40aae7a5ce378f9e1a8c13f9f978433#diff-c317a58e44887581899c30a9fc58a87b) where a few commands were removed form the [build/pluginbuilder/Dockerfile](https://github.com/heroiclabs/nakama/commit/fe4f8f0aa40aae7a5ce378f9e1a8c13f9f978433#diff-c317a58e44887581899c30a9fc58a87b) Making it seemingly impossible to build without a go.mod file which brings in the necessary dependencies.  
I believe it was mentioned in Gitter that the page is a bit outdated but I think mentioning the need for the go.mod with Nakama 2.7.0 and up would be very helpful.  
**Resolution:**  
This was resolved by running **go mod init \<module\_name\>** in the root of the folder and rebuilding.

2. Running **docker-compose up** in the test folder where the docker-compose.yml is produces an output which I will attach as a file due to its size. [nakama\_golang\_output.txt](https://forum.heroiclabs.com/uploads/short-url/nqWdmGtkylAyiVKO18FPTfnQQ7N.txt) (20.3 KB)  
Here is a screenshot of the folder structure, files and some of the more relevant contents. I tried to zip the folder and upload it but it is not a supported file type. Although it is just the nakama go example so I do not see how it could cause issues.  
Needless to say server fails to start.

---

<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:** [September 20, 2019, 9:33am UTC](https://forum.heroiclabs.com/t/unable-to-run-the-go-modules-example-with-nakama-2-7/216/2 "2019-09-20T09:33:00Z")

</div>

You’re right on your 1st point, Go modules built for Nakama 2.7.0 and up will require a `go.mod` file. This is being documented as we speak and will appear in the readme soon. It’s part of our efforts to ensure plugin builds work as universally as possible, in both binary builds and docker.

Issue 2 is interesting, I’m not sure we’ve seen this reported so far on any platform. It looks somewhat like a memory corruption issue which can indicate a problem with your local Docker environment. Have you tried the usual steps of restarting docker, checking it’s up to date etc?

---

<div class="post-metadata">

**Author:** ![igeorgievsd](https://avatars.discourse-cdn.com/v4/letter/i/96bed5/32.png) [@igeorgievsd](https://forum.heroiclabs.com/u/igeorgievsd)\
**Post date:** [September 20, 2019, 9:50am UTC](https://forum.heroiclabs.com/t/unable-to-run-the-go-modules-example-with-nakama-2-7/216/3 "2019-09-20T09:50:02Z")

</div>

Hi @zyro

Indeed, I went through those steps restarting computer as well.

I also double checked with a couple of colleagues and if the issue was specific to my Windows machine or not. As part of my trouble shooting I ran the exact same flow / commands on Mac OS and it all worked fine there.

Bumping the mini test project down to use Nakama 2.6.0 images and removing the go.mod file makes it work.

All of this leads me to believe that there is an issue somewhere in the chain of Nakama 2.7.0, Go 1.13, Docker and Windows.

I am not ruling out the possibility that this could be an issue in the configuration of our Windows machines that somehow is influencing the Docker VM environment. In fact I believe it is quite likely. However I do not have a working Windows environment to trouble shoot and compare with.

I will keep this thread updated with any new findings.

---

<div class="post-metadata">

**Author:** ![igeorgievsd](https://avatars.discourse-cdn.com/v4/letter/i/96bed5/32.png) [@igeorgievsd](https://forum.heroiclabs.com/u/igeorgievsd)\
**Post date:** [September 27, 2019, 8:12am UTC](https://forum.heroiclabs.com/t/unable-to-run-the-go-modules-example-with-nakama-2-7/216/4 "2019-09-27T08:12:39Z")

</div>

Quick update on this.  
In testing at home it was determined that using the Docker 2.7.0 images on Windows does in fact work and everything is fine.  
Comparing my home setup with my work setup the main differences I can see is windows version and IT policy.  
At work we are on Windows 10 1803 and at home I am on Windows 10 1903.

I can not test this theory at the moment but hopefully it helps someone. Note that this was also tested using Nakama 2.7.0 built with Go 1.13 and not Go 1.13.1.

---

<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:** [September 27, 2019, 8:51am UTC](https://forum.heroiclabs.com/t/unable-to-run-the-go-modules-example-with-nakama-2-7/216/5 "2019-09-27T08:51:36Z")

</div>

Thanks @igeorgievsd. I think as we’ve identified together that this issue is platform and version specific on Windows. I’ll lock this thread and if any other questions come up about Go custom code builds it can be opened on a new post.

I also recommend to any developers and studios who use the Go runtime support in Nakama server to check out our updated README on it:

> **[heroiclabs/nakama](https://github.com/heroiclabs/nakama/tree/master/sample_go_module#nakama-go-runtime)**
>
> Distributed server for social and realtime games and apps. - heroiclabs/nakama

---

<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:** [September 27, 2019, 8:51am UTC](https://forum.heroiclabs.com/t/unable-to-run-the-go-modules-example-with-nakama-2-7/216/6 "2019-09-27T08:51:46Z")

</div>

Closed on September 27, 2019, 8:51am UTC


