dqf98772
2014-11-12 08:12
浏览 41
已采纳

使用Godep的多个项目的单个或多个路径

Currently I'm using godep for package vendoring for Go. The problem is that I'm working on multiple projects depending on different versions of a certain package. I can't decide how to structure my GOPATH(s). I have several options:

  • Use a single GOPATH and use godep restore when switching between projects. The different versions of the certain package will be switched.
  • Use a GOPATH per project and only use godep restore when needed.

Which option is recommended and why?

图片转代码服务由CSDN问答提供 功能建议

当前,我正在使用Godep进行Go的软件包销售。 问题是我正在根据某个程序包的不同版本进行多个项目。 我无法决定如何构造我的GOPATH。 我有几种选择:

  • 在项目之间切换时,请使用单个GOPATH并使用Godep Restore。
  • 每个项目使用一个GOPATH,并且仅在需要时才使用Godep restore。

    建议使用哪个选项,为什么?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanbipu1720 2014-11-12 09:13
    已采纳

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

    Then I would recommend a GOPATH per project, in order to better isolate each dependencies, and make sure there isn't any mix_up in said dependencies.

    Within each GOPATH, you still can use the dependency manager of your choice.

    I use that even with vendoring (just to be sure to get an independent workspace)

    For vendoring, (Go 1.5+), I use govendor, typically:

    govendor fetch +m
    

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

    点赞 评论
  • dpg78570 2016-09-29 18:00

    As a note, this has been obsolete since 1.5 and the advent of vendoring in Go.

    点赞 评论

相关推荐 更多相似问题