## What happened
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.
## The fix that worked
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 value WithSecretVariable("GITHUB_TOKEN", token) plus a git config url rewrite like an https URL carrying your token as the username insteadOf https://github.com/YOUR_ORG/repo, with GOPRIVATE set. Both patterns are confirmed by Dagger contributors.