英文:
How to resolve packages dependencies in Go?
问题
你好!根据你的要求,我将为你翻译以下内容:
我对Go相对陌生,我想要下载一些源代码。然而,它导入了两个我没有的包,分别是:
import (
"git.schwanenlied.me/yawning/chacha20.git"
"golang.org/x/crypto/sha3"
)
在Go中是否有一种工具或方法可以自动读取目录中的源文件并下载所需的包?另外,当我尝试使用go get
下载它们时,会出现使用不安全协议(由于git)的错误。有什么解决这些依赖关系的想法吗?
英文:
I'm relatively new to Go, and I wanted some source code that I downloaded. Though, it imports two packages which I do not have, namely these two:
import (
"git.schwanenlied.me/yawning/chacha20.git"
"golang.org/x/crypto/sha3"
)
It there a tool or way in Go that automatically reads the source files in a directory and downloads the packages needed? On the other hand, when I just try to use go get
to download them, I get an error that it uses insecure protocol (due to git). Any ideas how to resolve these dependencies?
答案1
得分: 1
据我所知,目前没有这样的工具。但在你的情况下,你可以使用'go get',只需将行尾的.git删除。
go get git.schwanenlied.me/yawning/chacha20
对于导入语句也是一样的:
import (
"git.schwanenlied.me/yawning/chacha20"
"golang.org/x/crypto/sha3"
)
英文:
As far as I know there is no such a tool.
But in your case you may use 'go get', just remove .git from the end of the line.
go get git.schwanenlied.me/yawning/chacha20
same for import statement
import (
"git.schwanenlied.me/yawning/chacha20"
"golang.org/x/crypto/sha3"
)
答案2
得分: 0
你尝试过使用godep吗?你可以在这里阅读文档:这里
英文:
Have you tried godep? You can read the documentation here
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论