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

fix: make go-licenses work better with the embed package #90

Merged
merged 1 commit into from
Dec 16, 2021

Conversation

jimmale
Copy link
Contributor

@jimmale jimmale commented Dec 15, 2021

As per discussion in #79 , go-licenses with the --force option currently deletes the output directory before loading the packages. If the output directory is embedded in the application with the embed.FS package, this results in compilation (and by extension, loading) to fail, which in turn causes go-licenses to fail.

This PR swaps the order of operations (as recommended by @wlynch) so that the output directory is deleted after go-licenses has already collected the licenses.

The use case for this is to embed all of the licenses of a golang application's dependencies in the golang application itself, so that they can later be retrieved. For example, by a --license CLI argument or something similar.

@wlynch
Copy link
Contributor

wlynch commented Dec 16, 2021

Thanks! 🎉

@wlynch wlynch merged commit baa4dc1 into google:master Dec 16, 2021
@n3wscott
Copy link

This PR has introduced a bug where when you run the tool on an existing repo with the output directory in the project being scanned, https://github.com/google/go-licenses/pull/90/files#diff-63d2514e96da76ad8bd5c2460f4ea67c0a6c6ba1055a8890b7ec0c686bcc183fR70 finds all the previous license, which then are not locatable after https://github.com/google/go-licenses/pull/90/files#diff-63d2514e96da76ad8bd5c2460f4ea67c0a6c6ba1055a8890b7ec0c686bcc183fR76 if you use the tool with the the --force flag in play.

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

3 participants