-
Notifications
You must be signed in to change notification settings - Fork 22
Packages erroneously fail with multiple package main
& build +ignore
files
#138
Comments
Hi, welcome! Glad you're here! Yes, I think gps would be well-suited for the case you're describing. In fact, it's exactly one of the kinds of integrations that I was hoping would arise. The issue you're seeing is an unfortunate byproduct of gps still relying on While the inline comments indicate that I started writing a further hack to make this particular case work, but it just didn't quite seem worth it, being that my plan (#99) is to get rid of If you're interested in doing that, all it would take to make one of the existing test cases cover this particular problem is running this from the repo root:
With that, |
And, more generally - yes, I absolutely welcome reports of gps dealing with real code improperly! I expect there's going to be quite a few more such reports once we open up the new tool (very soon), but that's no reason not to get them in now. Compiling and running the wrt basing tests on real packages - while I'm all for running the code against them to discover problems, in general I prefer to base the tests on mocked data where possible. This keeps testing times down, and maximizes failure locality. |
What do you think about respecting build tags strictly in Line 74 in 4af1eef
|
@kamilchm that won't help either, unfortunately. It would result in solutions that are arch-specific, which is expressly not the goal. |
It works for my own one platform after that. I know it could smells bad but how about setting all archs in |
Right, that's the other part - if we turn off This approach fits the purpose of This is the goal because doing otherwise opens up the possibility of generating an incomplete (i.e. imports unique to a given build tag are missed, but the user actually needs that build tag in their chosen workflow) or non-portable Because these use cases vary so significantly, I view
All that's pretty hard, though :) In the meantime, the existing logic could be modified to encapsulate the ignored-main-finding logic in a closure, then looping and re-running |
Given our example how would I tell |
You can't, but that's not relevant in the particular example you gave. The logic just needs to change to handle more than one file following this pattern - as the comments indicate it should.
I detailed a possible approach to this in my last comment, but again, it's not relevant to solving the specific problem you encountered.
Yes, again, make the existing logic work when there's more than one file with
Safety and completeness are the goal here; efficiency is relevant once they've been satisfied. (
I'd say that's possible, judging from these questions. |
Is there a doc or test that show the use case for ignoring packages like described here https://github.com/sdboyer/gps/wiki/gps-for-Implementors#ignoring-packages? I looked into test cases and see that Line 608 in 65939b4
If I understand it correctly, even when we do looping and re-running build.ImportDir() it will read imports from these ignored files?
|
Not quite. Ignores come into play when we calculate the set of import paths we actually care about from the
Yup. Because the goal of For now, though, we munge the import paths together from the main and non-main files, with the idea that it's less harmful to (potentially) have some extra unused deps than it is to make the main files non-buildable with the |
@rsc this discussion, particularly this comment, might be useful in your thinking about this problem space. |
@sdboyer thanks for explanation. |
package main
& build +ignore
files
This ended up being fixed by #149 :) |
Hi,
I'm the author of https://github.com/kamilchm/go2nix which tries to generate Nix dependency manager derivations for Go projects.
go2nix
is a little hacky tool but it gets job done for almost all Go programs in Nix/NixOS https://github.com/NixOS/nixpkgs/search?utf8=%E2%9C%93&q=go2nixI'm very happy with the new Go package management movement and I want to rewrite
go2nix
to use one common dependency solving code, whichgps
looks to be.I tried to run
gps
example and it failed on my 2 first test cases:github.com/cerana/cerana/cmd/bootserver
github.com/miekg/coredns
Is there something obvious in my examples that makes them fail?
I'm willing to help fixing
gps
and I think that good integration test based on a few real packages could help here. Is there something like that, which I can run and be sure I don't break anything?The text was updated successfully, but these errors were encountered: