gogo-modulesgoogle-cloud-source-repos

Go get from GCP source repositories


I'm trying to go get a repository from GCP Source repositories. This seems to be very very poorly documented but what I tried to do was running go get source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git.

But I got the error:

go: downloading source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git v0.0.0-20210621185528-a62b060bc13d

go get: source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git@v0.0.0-20210621185528-a62b060bc13d: verifying

module: source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git@v0.0.0-20210621185528-a62b060bc13d: reading https://sum.golang.org/lookup/source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git@v0.0.0-20210621185528-a62b060bc13d: 410 Gone server response: not found: source.developers.google.com/p/[MY-PROJECT]/r/[MY_REPO].git@v0.0.0-20210621185528-a62b060bc13d: invalid version: git fetch -f origin refs/heads/:refs/heads/ refs/tags/:refs/tags/ in /tmp/gopath/pkg/mod/cache/vcs/3eb4fda67ba3d1beb54fafd4a7594a34c06a66c44b1ffd91759a1b7362ecfa4d: exit status 128: fatal: unable to connect to source.developers.google.com: source.developers.google.com[0: 173.194.200.82]: errno=Connection refused source.developers.google.com[1: 2607:f8b0:4003:c0d::52]: errno=Connection refused

How can I make it work?


Solution

  • Fixed by adding GOPRIVATE=source.developers.google.com. Seems that go mod was trying to use a public connection which was being refused by Source.