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

LICENSE file in repo root is ignored #186

Open
derpsteb opened this issue Feb 15, 2023 · 4 comments
Open

LICENSE file in repo root is ignored #186

derpsteb opened this issue Feb 15, 2023 · 4 comments

Comments

@derpsteb
Copy link

Hey everyone,

according to the Go Modules Reference the go command would use a LICENSE 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.

@Bobgy
Copy link
Collaborator

Bobgy commented Feb 22, 2023

The mentioned behavior is already replicated by go when it downloads module caches.

Are you talking about modules in your main repo?

@Bobgy
Copy link
Collaborator

Bobgy commented Feb 22, 2023

Besides, can you share a repo that can reproduce this error?

@derpsteb
Copy link
Author

derpsteb commented Feb 24, 2023

To reproduce the error you could run:

git clone https://github.com/edgelesssys/constellation.git && cd constellation && rm ./operators/constellation-node-operator/api/LICENSE && go-licenses check ./...

Sorry, the repo is a bit big, but it should be easily reproduce the problem.
We have a monorepo and the offending module is a submodule within that repo.

@jmdeal
Copy link

jmdeal commented Feb 16, 2024

As another example, we're taking a dependency on github.com/awslabs/amazon-eks-ami/nodeadm. The repo, https://github.com/awslabs/amazon-eks-ami has a LICENSE file in its root but go-licenses returns the following error:

E0216 14:22:47.917881   39990 library.go:122] Failed to find license for github.com/awslabs/amazon-eks-ami/nodeadm/api/v1alpha1: cannot find a known open source license for "/Users/jmdeal/go/pkg/mod/github.com/awslabs/amazon-eks-ami/nodeadm@v0.0.0-20240212193458-d97e2ad07de4/api/v1alpha1" whose name matches regexp ^(?i)((UN)?LICEN(S|C)E|COPYING|README|NOTICE).*$ and locates up until "/Users/jmdeal/go/pkg/mod/github.com/awslabs/amazon-eks-ami/nodeadm@v0.0.0-20240212193458-d97e2ad07de4"

Additionally, when I looked in the local copy of the module the LICENSE file did in-fact exist.

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