Cannot compile custom Go plugin because of private modules

I am currently trying to compile a custom plugin for Tyk written in Go. I’ve been trying to use the tykio/tyk-plugin-compiler image to ensure that I have the proper dependencies with our version of Tyk Gateway(v5.2.1). However, I get error messages regarding git credentials (i.e. no username provided so Go can clone the private module.) Vendoring the modules seems to be ignored because Go workspaces are being used during the build.

I’d like to avoid having to put together a custom image to do the build. Is there a proper way to avoid this issue?

Hello @tdohm and welcome to the community.

I have asked this question internally. I’ll update this thread when I get a reply.

I have gotten a response internally

Based on this stack overflow Using SSH keys inside docker container - Stack Overflow

Adding a few flags to the docker run invocation should be enough:

 --mount type=bind,source=$SSH_AUTH_SOCK,target=/ssh-agent \
             --env SSH_AUTH_SOCK=/ssh-agent

^ this forwards the ssh-agent socket to be available to plugin compiler


^ this sets the required env var where SSH auth would be used

Hope this helps

Hi @Olu, this did indeed help. Thanks!