简体   繁体   中英

Golang Dep unable to read metadata: go-import metadata not found

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?

[ 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM