-
-
Notifications
You must be signed in to change notification settings - Fork 664
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
dependency with same name as directory causes "missing strict dependencies" error #831
Comments
As described above, this is the result of a change in behavior of
We're planning to move away from
For projects that follow We don't yet have a good story for projects based in google3. Using Buildozer to list rules, calculate the import paths based on label, would be straightforward with a shell script, but it doesn't seem like Copybara supports custom transformations. It does support buildozer commands, but you would need to hard-code all of the @ianthehat had an idea: add
Is that something that would work for you? |
For the short-term, I can fix my repo by changing the imports in my go files to remove the duplicated final element. That is something that copybara can do easily. (Not sure why I didn't think of this yesterday.) Still though, this change was undocumented and surprising to me, and may be to other users as well. For the long-term solution, what you propose will certainly work. However, it's a bit annoying to have to add all of the importpaths in our BUILD files manually, and keep them up-to-date when the code moves. I think it should be possible to generate these attributes automatically (go_importpath basically generates them implicitly now). I'll talk with the Buildozer team to see if there is some functionality we can add that would make this work. |
Ok, sounds like that will be the easiest path. Sorry this change wasn't documented more loudly. We probably should have mentioned it in the release notes at some point. Agree it's annoying to add importpaths automatically. Gazelle and Buildozer could automate a lot of this, but it's difficult to use that with Copybara. |
A dependency with the same name as its directory (
deps = ["//foo:foo"]
) causes an error. The error also occurs if the short-form name is used (deps = ["//foo"]
).Here is a small repro:
https://github.com/nlacasse/rules_go/tree/deps-test/tests/trans_dep
The
//tests/trans_dep:lib
target builds correctly on 0.5.3, but fails on 0.5.4 and 0.5.5 with the following error:The error is coming from the
checkDirectDeps
function:https://github.com/bazelbuild/rules_go/blob/master/go/tools/builders/compile.go#L127
The cause of the bug seems to be that we stopped adding the last part of the path in go_importpath if it is a "stutter":
https://github.com/bazelbuild/rules_go/pull/716/files#diff-b2f5a5f41a12c9d41a59f56369d54834L202
This seems wrong, since it is perfectly reasonable to have a package named //foo:foo.
The text was updated successfully, but these errors were encountered: