tools / godep

dependency tool for go
http://godoc.org/github.com/tools/godep
BSD 3-Clause "New" or "Revised" License
5.54k stars 454 forks source link

Godep does not save dependencies for packages with build tags #529

Closed cadencefinch-wf closed 7 years ago

cadencefinch-wf commented 7 years ago

Expected behavior

godep save ./... should save all dependencies for all files, regardless of if the files have a tag and !tag build tag in the code

Actual behavior

Packages that have a build tag, but do not have a !build tag do not get processed

Steps to reproduce behavior

I have a project like this

I have some code that uses mytag as a build tag but no code that uses !mytag as a build tag. When I run godep save ./... the dependencies for tagged_code.go are not written to Godeps.json or vendor. I can manually get those dependencies added by running godep save ./... && godep save ./subPackage2 or by having a dummy file in subPackage2 with a !mytag build tag, but that's annoying to have to do.

godep version output

godep v77 (darwin/amd64/go1.7.1)

go version output

go version go1.7.4 darwin/amd64

Contents of Godeps.json file

This is a private repro, can't post that

freeformz commented 7 years ago

Godep ignores build tags (except ignore and appengine), so I'm not sure why this is happening.

freeformz commented 7 years ago

With that said, I was able to reproduce this. :-(

cadencefinch-wf commented 7 years ago

That looks like the case I have setup in my project, nice to know your were able to reproduce it in an isolate case