-
Notifications
You must be signed in to change notification settings - Fork 126
LICENSE
file in repo root is ignored
#186
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
Comments
The mentioned behavior is already replicated by go when it downloads module caches. Are you talking about modules in your main repo? |
Besides, can you share a repo that can reproduce this error? |
To reproduce the error you could run:
Sorry, the repo is a bit big, but it should be easily reproduce the problem. |
As another example, we're taking a dependency on
Additionally, when I looked in the local copy of the module the LICENSE file did in-fact exist. |
resolves google#73, resolves google#186 For modules that are not at the root of the repo, Go will make a copy of the LICENSE file from the repo root into the module's directory when creating the .zip file (see https://go.dev/ref/mod#vcs-license) This throws off URL generation, as FileURL will create a link to a repo URL to the license that doesn't exist as the file was synthesized by Go. Attempt to detect this case by examining the zip file that Go creates - As it stands, it appends the LICENSE file to the zip's file directory; we can generally assume that if we see such an addition, it's a result of Go copying it there and therefore it's not a real file in the repo, instead being copied from the root. If we find that to be the case, generate a link to the original LICENSE file at the root of the repo instead. The complex e2e test here exercises this nicely (updated links didn't work before, now they do).
resolves google#73, resolves google#186 For modules that are not at the root of the repo, Go will make a copy of the LICENSE file from the repo root into the module's directory when creating the .zip file (see https://go.dev/ref/mod#vcs-license) This throws off URL generation, as FileURL will create a link to a repo URL to the license that doesn't exist as the file was synthesized by Go. Attempt to detect this case by examining the zip file that Go creates - As it stands, it appends the LICENSE file to the zip's file directory; we can generally assume that if we see such an addition, it's a result of Go copying it there and therefore it's not a real file in the repo, instead being copied from the root. If we find that to be the case, generate a link to the original LICENSE file at the root of the repo instead. The complex e2e test here exercises this nicely (updated links didn't work before, now they do).
Hey everyone,
according to the Go Modules Reference the
go
command would use aLICENSE
file from the repo root if it can not find one in the module's directory and is currently not in the repo's root dir.However, it seems like
go-licenses
currently does not replicate this behavior. At least I am getting an error along the lines of:Failed to find license for modulename: cannot find a known open source license for "path/to/module" whose name matches regexp ^(?i)((UN)?LICEN(S|C)E|COPYING|README|NOTICE).*$ and locates up until "path/to/module/.."
Even though the root folder of the repo that contains the submodule
modulename
has a valid LICENSE file in the root folder.Should I look elsewhere for a reason or is this really not supported? :P
Best.
The text was updated successfully, but these errors were encountered: