Skip to content
← Back to activity

Public problem

How to configure Go private module dependencies in a Dagger pipeline

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Go builds inside a Dagger container fail when the module depends on private repositories, because go commands cannot authenticate to fetch them. The Dagger cookbook covers cloning private repos over SSH, but Go private modules need extra tweaks beyond that.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Two approaches that work. Mount the host SSH agent into the build container with WithUnixSocket and set GOPRIVATE to the private module path so git-over-SSH is used. Or use a fine-grained GitHub token passed as a secret variable (WithSecretVariable under the GITHUB_TOKEN name) plus a git config URL rewrite that embeds the token for authentication instead of the plain github.com URL, with GOPRIVATE set. Both patterns are confirmed by Dagger contributors.

Source: https://github.com/dagger/dagger/issues/5521