5

I am transitioning over to use golang Dep https://github.com/golang/dep

We have repositories for microservices that use a common code base.

Its hosted at git.corp.company.com/Organization/common-base

in vendor base we have a projects structure as follows

vendor
  git.corp.company.com
    Organization
      common-base
  github.com
    ... online dependencies like aws, garyburd, etc...
  golang.org
    X
      sys
      text

When I try to do dep init, I get an error message like

unable to deduce repository and source type for "git.corp.company.com/Organization/common-base": unable to read metadata: go-import metadata not found

I'm not sure why that is happening and what to do next. Do I need to add in the metadata file to our common code?

Sakib
  • 1,503
  • 4
  • 26
  • 39

1 Answers1

5

[ Update: dep has this feature support in their roadmap ]

dep/go get uses the go-import meta tag to get the dependencies. So, you may need to add this meta tag to your git.corp.company.com page.

For Example: When you do go get golang.org/x/crypto, it checks the go-import meta tag to know more information about this library like, where it is hosted and which source control they use. This information is provided to it via the go-import meta tag. See below:

$curl -L -s golang.org/x/crypto | grep -i go-import
<meta name="go-import" content="golang.org/x/crypto git https://go.googlesource.com/crypto">

OR else, you can setup a proxy for this purpose.
OR there are some alternatives, where appending .git to import path can also help.

RaviTezu
  • 3,047
  • 19
  • 26