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

Go: add license detection #5617

Closed
arieltorti opened this issue Jul 27, 2022 · 8 comments
Closed

Go: add license detection #5617

arieltorti opened this issue Jul 27, 2022 · 8 comments
Labels
enhancement Issues that are considered to be enhancements scanner About the scanner tool won't fix An issue that will not be fixed

Comments

@arieltorti
Copy link

Go mod currently doesn't provide license or copyright information for go modules hence ORT doesn't provide detected licenses for them.

In order to add license detection using go mod I propose to either integrate ORT with https://github.com/google/go-licenses or apply the same technique.

@sschuberth
Copy link
Member

Go mod currently doesn't provide license or copyright information for go modules hence ORT doesn't provide detected licenses for them.

Before going deeper into the discussion, let's ensure we're aligned on the terminology: What ORT calls "detected licenses" (and copyrights) are those determined by ORT's scanner tool. I.e. license / copyright findings returned by a scanner like ScanCode.

On the other hand, in ORT's terminology "declared licenses" (and copyrights) stem from package metadata (probably go.mod in this case) or package registries, and these are determined by ORT's analyzer tool.

So, what I assume you're saying is that ORT's analyzer fails to find declared licenses for GoMod?

What's the source for license information that https://github.com/google/go-licenses uses, is it metadata or source code?

@sschuberth sschuberth added enhancement Issues that are considered to be enhancements analyzer About the analyzer tool needs info An issue where further information is required labels Jul 27, 2022
@fviernau
Copy link
Member

fviernau commented Jul 27, 2022

ORT distinguishes between declared and detected licenses. Declared licenses are defined in the package metadata, whereas go.mod files do not provide any means for doing so. Detected licenses are the licenses which reside in any file in the corresponding code respository. As ORT's GoMod integration is capable of figuring out the source code location, either the source artifact '.zip'' file or the VCS location, running ORT's scan stage on top of the analysis result will in fact detect the licenses as well as copyright statements.

The license tool above seems to run a license scanner just against the LICENSE file, while ORT runs it against any file in the code repository (disregarding some exclusion patterns for special files). The primary scanner used by ORT is ScanCode. So, how does ScanCode compare to above tool you mentioned?

All in all, I believe this ticket is invalid.

edit: After writing this I found @sschuberth wrote at the same time, so sorry for the slight redundancy.

@sschuberth
Copy link
Member

sschuberth commented Jul 27, 2022

What's the source for license information that https://github.com/google/go-licenses uses, is it metadata or source code?

So, after having a look it indeed seems as if https://github.com/google/go-licenses looks at license files in the source code (not metadata) and uses https://github.com/google/licenseclassifier to identify the license / SPDX id from the license file text.

As such, I believe all is fine with ORT's GoMod anaylzer. But we could consider adding https://github.com/google/licenseclassifier as yet another simple scanner implementation.

@sschuberth sschuberth added scanner About the scanner tool and removed analyzer About the analyzer tool needs info An issue where further information is required labels Jul 27, 2022
@fviernau
Copy link
Member

@sschuberth @arieltorti. So, shall we convert this ticket to 'adding licenseclassifier as scanner', or close this ticket and open-up a new one?

@sschuberth
Copy link
Member

So, shall we convert this ticket to 'adding licenseclassifier as scanner', or close this ticket and open-up a new one?

I'd say we're blocked by google/licenseclassifier#47 for now. Let's see how they react and decide depending on that.

@arieltorti
Copy link
Author

arieltorti commented Jul 27, 2022

I'll give it a try tomorrow; If the scanner already gives license information that should be enough for me.

What would be the process, running ORT analyze and then scan on the output of the analyze ?

And further on, can the reporter use the output of the scanner and the analyzer ? Our intention is to have a report of the licenses used across many microservices, #5620 talks a bit more about it.

@sschuberth
Copy link
Member

What would be the process, running ORT analyze and then scan on the output of the analyze ?

Yes, the input to the scanner is the output of the analyzer. See the respective Getting Started section for details.

And further on, can the reporter use the output of the scanner and the analyzer ?

That's implicitly so: Analyzer and scanner do not create separate outputs, but ORT result files are always amended by the tool being run. So the analyzer result is passed to the scanner, which amends its data to the analyzer result, creating a new single output file which contains both the analyzer and the scan result.

@sschuberth
Copy link
Member

Based on my earlier comment, I'm closing this as "won't fix" because licenses can already be detected with other scanners, and google/licenseclassifier#47 is still unresolved.

@sschuberth sschuberth added the won't fix An issue that will not be fixed label Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues that are considered to be enhancements scanner About the scanner tool won't fix An issue that will not be fixed
Projects
None yet
Development

No branches or pull requests

3 participants