gpt4 book ai didi

go - 使用 godep 的多个项目的单个或多个 gopaths

转载 作者:IT王子 更新时间:2023-10-29 02:16:40 25 4
gpt4 key购买 nike

目前我正在使用 godep 为 Go 提供包供应。问题是我正在根据某个包的不同版本处理多个项目。我无法决定如何构建我的 GOPATH(s)。我有几个选择:

  • 在项目之间切换时使用单个 GOPATH 并使用 godep restore。将切换特定包的不同版本。
  • 为每个项目使用一个 GOPATH,并且仅在需要时使用 godep 恢复。

推荐哪个选项,为什么?

最佳答案

I'm working on multiple projects depending on different versions of a certain package

然后我会为每个项目推荐一个 GOPATH,以便更好地隔离每个依赖项,并确保在所述依赖项中没有任何混淆。

在每个 GOPATH 中,您仍然可以使用您选择的依赖管理器。

我什至在 vendoring 中也使用它(只是为了确保获得一个独立的工作空间)

对于 vendoring,(Go 1.5+),我使用 govendor ,通常:

govendor fetch +m

Pull in new dependencies or update existing dependencies directly from remotes with govendor fetch.

关于go - 使用 godep 的多个项目的单个或多个 gopaths,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26882103/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com