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

vndr <pkg> or vndr should return error when import path is not vendored and not existent in GOPATH, GOROOT. #92

Open
Madhur1997 opened this issue Jun 21, 2020 · 3 comments

Comments

@Madhur1997
Copy link

This is more of a question rather than an issue.
Currently, when an import path isn't vendored and also doesn't exist in GOPATH or GOROOT,
vndr would typically exit with exit status=0.
Now, this will fail the package compilation, so it gets caught there.
But would it be good if we are to exit with non zero code if such situation arises?

@Madhur1997 Madhur1997 changed the title vndr <pkg> or vndr should return error when import path is not vendored and not existent in GOPATH, GOROOT vndr <pkg> or vndr should return error when import path is not vendored and not existent in GOPATH, GOROOT. Jun 21, 2020
@LK4D4
Copy link
Owner

LK4D4 commented Jun 22, 2020

I am not sure I understand the problem. I thought vndr <pkg> were supposed to download package to vendor directory, though I might remember wrong.
Do you have example repo where I could try that?

@Madhur1997
Copy link
Author

Madhur1997 commented Jun 23, 2020

Sorry, I wasn't clear enough.
Consider a scenario:
Suppose I create a go dir, add some imports, then I perform vndr init. This will install all the referenced imports in the vendor dir.
Now, I add another import say package 'A'.
I don't have 'A' on local file system yet. Now if I issue just vndr, this will be successful.
Now, in such a situation, the compilation would fail obviously.
But, I was wondering if it was better to log the missing package as well.
Currently, in this workflow, we hit the following case in 'collectAllDeps' method.

if err != nil {
if strings.Contains(err.Error(), "cannot find package ") && dlFunc != nil {
ipkg, err = dlFunc(imp)
}
}
Here, dlfunc is nil, so we just end up ignoring the 'cannot find package' error.

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

No branches or pull requests

3 participants
@LK4D4 @Madhur1997 and others