Skip to content
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

Return a more user-friendly error in workspace targeting for overlaps #2982

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

doriable
Copy link
Member

In the past, if the an overlap is found between moduleDirPath and inputPath,
but inputPath does not exist (e.g. moduleDirPath == "." and inputPath == "fake-path")
then it would return the error:

failed to build input "fake-path" because it is contained by module at path "." specified in your configuration, you must provide the workspace or module as the input, and filter to this path using --path"

Which isn't particularly clear, since fake-path doesn't exist. Added a check to return a
nicer error to the user by checking inputPath. Also included test cases for v1 and v2
workspaces.

@doriable doriable requested a review from bufdev May 16, 2024 00:02
for _, moduleDirPath := range moduleDirPaths {
if normalpath.ContainsPath(moduleDirPath, inputPath, normalpath.Relative) {
// In the case where the inputPath would appear to be relative to moduleDirPath,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the path does exist but is empty though, this will be a confusing error message as well right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is true -- ideally I want to check if the directory is a valid prefix for the bucket. Given the IsEmpty check, I've tweaked this to return ErrNoTargetProtoFiles since the inputPath is empty (and I still think this is a valuable check/improvement over just returning the overlap error).

@bufdev
Copy link
Member

bufdev commented May 16, 2024

Let's punt this until after the release

@bufdev bufdev changed the base branch from dev to main May 16, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants