Skip to content
This repository has been archived by the owner on Feb 26, 2019. It is now read-only.

godep save inconsistent between platforms #161

Closed
jzelinskie opened this issue Dec 19, 2014 · 8 comments
Closed

godep save inconsistent between platforms #161

jzelinskie opened this issue Dec 19, 2014 · 8 comments

Comments

@jzelinskie
Copy link

I have some code (closed source 😿) that has a dependency using the // +build construct to variably include some of their source files. This leads to dependencies in those files from being excluded if godep save is ran on a platform that does not require those files.

If I godep save on Mac, it'll build and run perfectly fine on Mac, but if I take that codebase and try and build it on Linux, the Godeps directory will be missing dependencies and will fail to compile. I'm currently resolving this by only doing godep save/godep update on Linux, but it is not a long-term solution as all of our developers are primarily working on Mac.

@rnapier
Copy link

rnapier commented Jan 7, 2015

I've been playing with ways to address this. It's possible to pass -tags to the "go list" command, so you could pass the tags "darwin linux". That works ok as long as nothing uses the ! syntax. So if you had a !linux, it would not include it even though you'd want it. That's causing me trouble on Windows because some things in the standard library are defined as !windows rather than an explicit list of everything else.

The other option is to run LoadPackages once for each desired tag and then merge the results. That's probably the way it needs to work, but the code is more complicated.

@jzelinskie
Copy link
Author

Sorry that I didn't post this earlier: the workaround that we've been using is to just use GOOS=linux go get -d ./... for getting dependencies. We're just lucky that there isn't anything excluded that OSX requires.

@phinze
Copy link

phinze commented Feb 2, 2016

Hey folks, we just switched to Godep over in hashicorp/terraform and we're running into this problem.

We build Terraform for several platforms and we're running into problems trying to vendor the superset of dependencies without constantly fighting diffs or manually editing metadata.

Have any of you come up with methods for addressing this issue?

The other option is to run LoadPackages once for each desired tag and then merge the results. That's probably the way it needs to work, but the code is more complicated.

We might investigate this as a PR if it sounds like a valid approach to everybody.

@freeformz
Copy link

What version of godep are you using? At this point godep no longer uses go list to resolve any dependencies and processes files/deps for all files except those that include the appengine or ignore build tags.

@phinze
Copy link

phinze commented Feb 2, 2016

Hi @freeformz - thanks for the tip! Looks like we were indeed running an older version of godep.

Did a fresh go get -u and this seems to be resolved w/ the newer version.

hashicorp/terraform#4957 looks to have the proper superset dependency list

Since everything seems to be working I believe this (and the linked #174) can be closed. 👍

@freeformz
Copy link

Great! Thanks. Closing. For anyone else on this ticket please re-open / post a follow up if, after updating, things aren't working for you.

@jzelinskie
Copy link
Author

@freeformz, I've encountered a similar issue on v52 when recently vendoring. I need to double check to see if it is also caused by +build or something else, but I did not have all the proper dependencies.

@freeformz
Copy link

@jzelinskie If so please file that as a separate issue unless someone else has already done so. ;-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants