Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go Get for Google's Cloud Source Repository

Making two different go modules

  1. source.cloud.google.com/me/a

  2. source.cloud.google.com/me/b

With source.cloud.google.com/me/common as a common lib dependency (to share a model)

I'm trying to go get source.cloud.google.com/me/common (even manually wrote it in the go.mod file) but I keep receiving the following error:

package source.cloud.google.com/me/common: 
unrecognized import path "source.cloud.google.com/me/common" 
(parse https://source.cloud.google.com/me/common?go-get=1: no go-import meta tags ())

I have gcloud set up to be able to use app deploy and create new source repositories. I've tried setting up ssh for google cloud and attempted to use manual credentials. This neither works locally or in the google cloud build service.

I want to do two things:

  1. Be able to go get this dependencsource.cloud.google.com/me/common
  2. Be able to integrate this go get into my App Engine automated build pipeline.

Any help would be appreciated.

like image 335
Jared Hooper Avatar asked Apr 20 '19 17:04

Jared Hooper


2 Answers

  1. Configure repo on https://source.cloud.google.com/
  2. Authorize manual git access https://source.developers.google.com/p/YOUR_PROJECT_ID/r/YOUR_REPO In this example: https://source.developers.google.com/p/m/r/common
  3. Your common module should go like source.developers.google.com/p/m/r/common.git
  4. Run: go get source.developers.google.com/p/m/r/common.git on the other module
like image 194
Jeisson Avatar answered Sep 16 '22 15:09

Jeisson


I would try the following steps:

  1. Make sure it has manual git access - You can try a git clone from folder "a" to check if correct git access is in place. Delete it after it gets cloned.
  2. Make sure that you are using HTTPs - looks like you are good in that regards - go1.14 made HTTPs as default for go get's.
  3. Now, coming to the actual problem - looks like your private version control systems isn't sending the required "go-import" meta tag.

For example - refer any github go module, you can see the "go-import" meta tag: Zap module for logging

In order to fix it, the VCS server needs to respond with this tag when go get tries to download "common" module

<meta name="go-import" content="source.cloud.google.com/me/common git https:source.cloud.google.com/me/common">
like image 25
Viggi Avatar answered Sep 17 '22 15:09

Viggi