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

Check for go package directory existence before accessing #274

Merged
merged 1 commit into from
May 27, 2020

Conversation

jonabc
Copy link
Contributor

@jonabc jonabc commented May 27, 2020

Fixes a crash seen when go list tells licensed that a package has a directory that doesn't exist. This was seen when referencing a repo with multiple module while also using GOFLAGS="-mod=vendor".

In this case go list was assuming that all dependent packages used would live in the vendor folder, which is not true for other modules defined in the repo. In go < 1.14 this causes go list to fail entirely and in go 1.14 the reference to a directory that doesn't exist causes licensed to crash by trying to Dir.chdir to the non-existent repo. The fix here checks for the existence of the repo before trying to change to its directory.

/cc @vroldanbet @macripps

@jonabc jonabc merged commit d5e2b44 into master May 27, 2020
@jonabc jonabc deleted the go-directory-existence branch May 27, 2020 16:28
@jonabc jonabc mentioned this pull request Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant