go-license-detector
go-license-detector copied to clipboard
Access additional license data
The change in this PR addresses a problem described in the issue "Make license database public". In order to get access to additional license data the two new exportable functions were added:
- LicenseURLs - it returns a list of URLs where the license can be found in the internet
- LicenseName - it returns the full name of the license
The values are get from the JSON representation of the license stored in the https://github.com/spdx/license-list-data/archive/v$(SPDX_DATA_VERSION).tar.gz as all other information about the licenses. But to get the fully qualified URLs the third column was added to the urls.csv file and it contains schema of the URL. That is done to have possibility re-build the full URL and do not change existing format of the second column that may be used by someone already.
Both functions return a new
ErrUnknownLicenseID
error in case the license ID provided as a parameter doesn't exist in the database.
The change also includes upgrade of the SPDX_DATA_VERSION to the latest at the moment 3.17 version. After the update the tool begun to panic because of the index access to the empty slice. The fix has been applied to solve that issue. After the upgrade the expected confidence in the tests were adjusted to the new results.
The one question that remains open here is why .mit-license.org
literal is used in the licensedb/internal/assets/extract_urls.go
? Should it be changed to the ://mit-license.org
to have a proper URL format?
@bzz could you please take a look at this PR? Unfortunately the list of the maintainers doesn't exist by the reference that is mentioned in the Contributing Guidelines
Hi @lafriks! Thanks for taking an eye on my changes. Could you please explain why .mit-license.org
is used instead of ://mit-license.org
(the last paragraph in the PR description)?
Seems like Lint job fails because golangci/golangci-lint-action
needs to be updated or the configuration needs to be changed to use the newer version of the golangci-lint. I don't have permissions for doing this, so I rely on maintainers of the repository to do this.
Update: I have increased version of the golangci-lint tool to 1.47.0 version and fixed the issues.
I don't think I have ever supported windows, it's ok to remove the CI checks for that OS.
I don't think I have ever supported windows, it's ok to remove the CI checks for that OS.
@vmarkovtsev I have removed Windows OS from the actions, hope the CI will pass this time.
Hey @vmarkovtsev, is there anything we can do to help get this PR over the finish line? @pavelmemory made the necessary changes to drop CI for Windows (this would actually close #22).
As CI is green now and there are new tests and review ✅ - I'll be merging this, if there is no further discussion.
As this change includes new API - it's a bit hard for me to say off hand how backward-compatible is it, and if it is - I assume v4.4.0 needs to be released, otherwise, it's v5.0.0.
WDYT?
API seems to be backward compatible as only adds new methods so imho v4.4.0 is way to go
Closed&re-opened to trigger the CI, going to merge as soon as it passes. Then rebase #24 -> ✅ -> 🔪 v4.4.0
Linter complains on the licensedb/filer/filer.go
that was not changed in this PR and thus is not relevant (would be nice to have a separate issue for handling it in the future).
...wonder what makes Race CI profile run 20min here, while it's only 6m in #24 🤔