-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make gazelle play well with vendor directories from dep #725
Comments
It sounds like the solution to this would be for Gazelle not to generate |
Also, worth noting that longer term we would rather have a tool that added/updated repository rules in the bazel worspace from dep information, so bazel users never need to see a vendor directory. |
@ianthehat that sounds like an anti-feature from my perspective -- I have a hard requirement that I'm not allowed to download dependencies from the internet during build, instead I have to check in vendor/ (and keep a fork of this project to override the location of the go toolchain). @jayconrod That sounds kinda awesome -- I never really want to run the vendor/... tests anyway. This is more than just dropping |
@swsnider I haven't played with dep yet, but it surprises me that they don't download all transitive dependencies of a repository. I thought they were going to be working at the granularity of repos, not packages, but I guess that's just for versioning. Gazelle currently doesn't keep track of what's used or not, so I don't think this is going to be practical for us, at least in the short term. Removing the generated BUILD.bazel files for unused packages is the right thing to do if you don't want the dependencies. You can add a |
@jayconrod thought of doing that, but dep always overwrites the entire vendor directory in order to ensure consistency, so I wasn't able to do what I want because I need to be able to add them to the great-great-grandparent (or whatever) BUILD file, which isn't supported :( |
That seems like something we should support, too. I've filed #730 to track that specifically. |
I've 'fixed' this on my side by creating a go binary that reads the dep lockfile and deletes all directories not mentioned in the lockfile, and by having a shell script to replace directly invoking dep that invokes dep, invokes this cleaner binary, invokes gazelle on the vendor directory, then invokes buildozer several times to clean up the gazelle-generated files. Specifically, it does the following buildozer invocations:
Maybe this is the best approach we can have right now without a shitload of work on rules_go to support this potentially moving target? |
I'm running into a similar problem, I think.
imports I believe this is a separate issue than the one above, which is about test dependencies declared by an import and not recognized by Gazelle. |
I'm trying to add Bazel rules to a dependency now and running into this problem I load
which expects
to be present. I don't need those - I only need |
hi folks - thanks @kevinburke for pointing dep folks to this. i don't quite fully understand all the goals here, but a few notes from what i do think i grok:
|
@kevinburkeotto Thanks for posting that example. I think it makes sense for Gazelle to continue generating rules for whatever sources are present in the directory. The only other solution I can think of would be to only generate |
(apologies for the 2 different accounts thing - I posted from my work Github account by accident) |
Closing old Gazelle issues. I've migrated the remaining work to bazel-contrib/bazel-gazelle#37. This covers disabling Note that the ability to exclude subdirectories in vendor is now implemented via |
I use gazelle in vendored mode by running
gazelle -external vendored
.When I use dep to generate a vendor directory for a project that uses
github.com/sirupsen/logrus
, I get a bunch of build failures becausevendor/github.com/stretchr/testify/assert
doesn't exist (since dep doesn't consider tests of your dependencies to also be dependencies, and didn't download it tovendor/
). It would be amazing if gazelle also supported such a mode so that I can stop tearing my hair out about this issue.The text was updated successfully, but these errors were encountered: