dsf4354353452 2016-05-10 17:32
浏览 41
已采纳

Godeps的发展流程?

Bit confused with Godeps in general. Say I'm contributing Go code to a central repository, and now I need to pull the code and contribute my own code changes. What would be the correct godep flow?

Would it be:

git pull  // pull latest master
godep restore // Install the package versions specified in Godeps/Godeps.json to $GOPATH
go get foo/bar  // Get package foo/bar and edit your code to import foo/bar
godep save ./...  // Saves dependencies
// Then, check into source control
  • 写回答

1条回答 默认 最新

  • douye2036 2016-05-10 23:37
    关注

    One option:

    git pull
    godep restore
    go get -u foo/bar // -u updates
    go test ./...
    go run main.go
    godep save ./...
    

    But, I don't like restoring to my GOPATH in disconnected HEAD states of git, since I contribute to several other repos (and have gotten errors in the past with this) directly within my GOPATH.

    So I usually do this:

    git pull
    go get -u foo/bar
    godep update foo/bar
    godep go test ./...
    godep go run main.go
    

    Using godep as a prefix changes the $GOPATH for go-related functions.

    TIP: set all the flags of your main executable with sensible defaults, for all developers. That way they don't need to pass custom parameters just for local development.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 asp.textbox后台赋值前端不能显示什么原因
  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误