I was wondering what do you recommend when having to deal with private go modules because the few options i'm looking at right now feel cumbersome to use ( i might be missing some steps in my setup).
Context:
When running go mod tidy, my app is pulling dependencies from private repositories.
Currently my local environment is configure to use SSH keys thanks to the insteaf.of switcheroo in my git config.
I tried building a dagger pipeline forwarding my SSH_AUTH_SOCK but i ended up with the Host key verification failed.
Does dagger has a best practice to deal with this ? any guide perhaps ?
here is a snippet of my current pipeline, wondering if i'm doing every by the book:
// Build -- Run Go Build
func Build(container *dagger.Container, socketPath string, sshSocket *dagger.Socket) *dagger.Container{
return container.WithWorkdir("/src").
WithEnvVariable("GOPRIVATE","github.com/doppledankster/myprivaterepo").
WithUnixSocket(socketPath, sshSocket).
WithExec([]string{"git", "config", "--global", "url.ssh://git@github.com/doppledankster/myprivaterepo.insteadOf", "https://github.com/doppledankster/myprivaterepo"}).
WithExec([]string{"go", "build", "-o", "./binary", "./cmd/app/main.go"})
}
Error message:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.