go mod to private repository using ssh

Skip to first unread message


Feb 18, 2021, 10:29:42 AM2/18/21
to golang-nuts
I've been avoiding the move to using go mod. Mainly because every time I try it chokes on any of the internal repositories i have setup using ssh://g...@mycoderepo.com:7900.  I put in to my ~/.gitconfig:

        insteadOf = https://mycoderepo.com/src

So now if I use git, and run:

It will then replace the https://mycoderepo.com/src/ with ssh://g...@mycoderepo.com:7900 and the clone works. Same with pull, fetch.

When I setup go modules, and then try to build a project that uses the gofunctions repository: import "mycoderepo.com/src/companyorg/gofunctions"

I get this:

Which brings up many questions. 1. Why is it using https when I told git to substitute that with ssh?  WHy is it going to GOOGLE'S DNS to resolve a company address that is internal and not using my system's DNS setup?

Manlio Perillo

Feb 18, 2021, 10:54:13 AM2/18/21
to golang-nuts
By default the go tool checks the module sum database, for security reasons and it also uses a module proxy, for performance reasons.
You can disable both, as described in https://golang.org/ref/mod#private-module-privacy

Reply all
Reply to author
0 new messages