go-license-detector icon indicating copy to clipboard operation
go-license-detector copied to clipboard

Access additional license data

Open pavelmemory opened this issue 1 year ago • 6 comments

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?

pavelmemory avatar Jul 18 '22 11:07 pavelmemory

@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

pavelmemory avatar Jul 18 '22 11:07 pavelmemory

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)?

pavelmemory avatar Jul 18 '22 12:07 pavelmemory

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.

pavelmemory avatar Jul 24 '22 11:07 pavelmemory

I don't think I have ever supported windows, it's ok to remove the CI checks for that OS.

vmarkovtsev avatar Jul 31 '22 06:07 vmarkovtsev

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.

pavelmemory avatar Aug 01 '22 10:08 pavelmemory

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).

To1ne avatar Aug 11 '22 13:08 To1ne

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?

bzz avatar Oct 06 '22 15:10 bzz

API seems to be backward compatible as only adds new methods so imho v4.4.0 is way to go

lafriks avatar Oct 06 '22 15:10 lafriks

Closed&re-opened to trigger the CI, going to merge as soon as it passes. Then rebase #24 -> ✅ -> 🔪 v4.4.0

bzz avatar Oct 06 '22 15:10 bzz

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).

bzz avatar Oct 06 '22 15:10 bzz

...wonder what makes Race CI profile run 20min here, while it's only 6m in #24 🤔

bzz avatar Oct 06 '22 15:10 bzz