英文:
Golang Dep unable to read metadata: go-import metadata not found
问题
我正在过渡使用golang Dep https://github.com/golang/dep
我们有一些使用共同代码库的微服务存储库。
它托管在git.corp.company.com/Organization/common-base
在vendor目录下,我们有以下项目结构
vendor
git.corp.company.com
Organization
common-base
github.com
...在线依赖,如aws、garyburd等...
golang.org
X
sys
text
当我尝试运行dep init时,我收到了如下错误信息
无法推断出“git.corp.company.com/Organization/common-base”的存储库和源类型:无法读取元数据:找不到go-import元数据
我不确定为什么会发生这种情况,下一步该怎么做。我需要在我们的共同代码中添加元数据文件吗?
英文:
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?
答案1
得分: 5
[更新:dep
在他们的路线图中有这个功能支持]
dep
/go get
使用go-import
元标签来获取依赖项。
因此,您可能需要将此元标签添加到您的git.corp.company.com
页面中。
例如:当您执行go get golang.org/x/crypto
时,它会检查go-import
元标签以了解有关此库的更多信息,例如它托管在哪里以及使用哪个源代码控制。这些信息是通过go-import
元标签提供的。请参见下面的示例:
$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">
或者,您可以为此设置代理。
或者还有一些替代方法,将.git
附加到导入路径也可能有帮助。
英文:
[ 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.<br>
OR there are some alternatives, where appending .git
to import path can also help.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论