douchui3933 2014-11-12 23:40
浏览 26
已采纳

golang和godep:使用godep时,在golang依赖项更新后进行Build \ install?

I have followed the instructions @ https://github.com/tools/godep regarding updating a dependency but when I go to build\install using the altered version it has not been updated within Godeps/_workspace/pkg

So I have

go get github.com/golang/glog
godep save
godep go install

and I can see

  1. The modification timestamp in Godeps/_workspace/pkg/linux_amd64/github.com/golang/glog.a
  2. The rev commit value in Godeps/Godeps.json

but now when I want to update I follow the instructions

go get github.com/golang/glog
godep update github.com/golang/glog
godep go install

I observe the following

  1. The Godeps/Godeps.json rev commit has been updated
  2. Godeps/_workspace/src/github.com/golang/ source is updated
  3. But the file timestamp for odeps/_workspace/pkg/linux_amd64/github.com/golang/glog.a is not updated hence we are using the previous version

I believe I should add a .gitignore entry for pkg and bin, which means we would do a clean build on a fresh git clone

I know I could do a rm -r on both the pkg and bin directories before the godep go install command

Is this expected behavior ?

Thanks in advance Pat

  • 写回答

1条回答 默认 最新

  • dousui6488 2015-01-05 23:13
    关注

    FYI

    Since golang v1.4 I can now use the -a flag for the go install command, since it now longer tries to rebuild the standard library, see the v1.4 release notes section on the change to the build -a flag

    Obviously this does not apply in pre v1.4 as it will attempt to rebuild the standard library packages

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

报告相同问题?