如何解决Go语言中的软件包依赖关系?

huangapple go评论74阅读模式
英文:

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

huangapple
  • 本文由 发表于 2017年6月13日 03:14:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/44507106.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定