-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Error messaging when BUILD file not present at top level directory is unclear #9364
Comments
What message would you suggest? |
Just to clarify @meisterT's question. The quoted issue
However, the error message literally states |
Note error message currently includes: So user has to work out that the two first references above are misleading, and the latter one As evidenced by 2 issues opened by different users in Other error traces from those issues:
and
I'm sure many would be able to figure out instantly that this means that the BUILD file is missing at the top level, but several others wont. |
Such a message without context would give the wrong impression that there were a requirement to have a Therefore, I also wouldn't call ...
... the first two references misleading; instead they give the needed context on where the offending reference was found (keep in mind that
This whole chain of reasons is useful to understand why So I still don't see any actionable suggestion on how to improve this already very detailed error message. |
Agreed, thanks anyway |
Something that'll help here is an additional educational message along the lines of "Unable to load package for //:WORKSPACE. A BUILD file is required to mark a directory as a Bazel package. BUILD file not found in any of the following directories.." Many users understand what packages and targets are, but have no idea BUILD files are use to mark package boundaries. I certainly took a while to learn where to place Made a PR: #9385 @nlopezgi wdyt? |
Hi @jin, |
@aehlig error messages, such as "BUILD file not found...", lack a "call to action". People who are new to Bazel will need to spend more effort to get past the error. This happened to me too (I am new to Bazel)! In contrast, this message is friendly and makes the most of the end-user's time:
I think that actionable error messages help everyone benefit from using Bazel. |
@nicoaragon I have an incoming change incorporating your suggestion. Thanks. |
It, however, it not in all cases the right thing to do. Adding a |
I think you care for accuracy. Also, you want to prevent people breaking their build. I care for end user experience and I want to empower Bazel users to be comfortable changing, and evolving their build. That includes breaking and fixing the build. In this case, I would be happy to make the change and break other labels, as long as Bazel lets me know that I did. What do you use to measure end user experience? |
…iles Let's print an actionable for the user and inform that BUILD files turn directories into packages. Fixes bazelbuild/bazel#9364 Closes #9385. Change-Id: Ia19133d2bfb0e71fdd03043592f525afddff740d PiperOrigin-RevId: 269350796
Description of the problem / feature request:
go_repository
now reads a configuration file, which, by default is WORKSPACE in the main workspace.The implementation of this feature is such that the error messaging when the file is not present is as follows:
This error message is already causing issues for rules_docker customers, as now this BUILD file is needed in all projects that depend transitively on gazelle.
Please see bazel-contrib/bazel-gazelle#609 (comment)
Also related:
bazelbuild/rules_docker#1139
bazelbuild/rules_docker#1126
Feature requests: what underlying problem are you trying to solve with this feature?
I would like to have better messaging for this type of errors.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Depend on gazelle (latest version) from a project that does not have a root BUILD file
fyi @laurentlb
The text was updated successfully, but these errors were encountered: