How to build go runtime plug-in on windows 10 machine

Hi there, I am new to go and docker.
I am trying to write and build go plugin on windows 10 machine. I found it is so frustrated.
First, I make go work on my machine. I don’t have any roadblock until I start to build it as a plugin. Then I realized it is impossible to build it from windows.
Then I installed a ubuntu in docker and install go there. While, when I run the command go get -u “github.com/heroiclabs/nakama-common@v1.4.0”. I get the error. x509: certificate signed by unknow authority. I spend hours on solving it but got no luck.
I am wondering how did you guys write plugin on windows machine? any suggestion will be appreciated!

@jiechen Due to this limitation in the Go plugin support in the Go toolchain its not possible to compile or load plugins natively on the Windows platform.

Most developers use the Linux subsystem for Windows to compile and run the plugin code with a native workflow. The preferred workflow we recommend though is to just use Docker to compile and run the plugin code in a multi-stage Docker build. There’s a good example on how to achieve that workflow here:

https://gist.github.com/novabyte/cc6d57022e2d3baa40e98d8fc91dc4c8

I get the error. x509: certificate signed by unknow authority. I spend hours on solving it but got no luck.

This looks like you may have an environment issue of some kind where the SSL certificate used by GitHub which is validated by a root certificate chain issued by DigiCert cannot be verified. You will need to ensure that if you’re inside a Docker container to perform builds you have the latest certificate store installed on Linux. This keeps the list of root authority certificates up to date.

You can see where the certificate store is downloaded in the Docker pluginbuilder image used by the GitHub gist above as part of the build workflow here:

https://github.com/heroiclabs/nakama/blob/master/build/pluginbuilder/Dockerfile#L35

Hope this helps.

I ended up with the Docker to build the plugin and it works.
Thanks for your help!

1 Like