diff options
| author | Sean Liao <sean@liao.dev> | 2025-12-08 19:46:25 +0000 |
|---|---|---|
| committer | Sean Liao <sean@liao.dev> | 2025-12-08 14:47:03 -0800 |
| commit | b1518c6a6f10ee9d41ccc22b0ba012a06e626aa4 (patch) | |
| tree | 41400046599655090bb275cf78bb1bafdbad2e2f | |
| parent | c3ac91df4d42d837427c71d2c894fe17f334aa71 (diff) | |
| download | go-x-pkgsite-b1518c6a6f10ee9d41ccc22b0ba012a06e626aa4.tar.xz | |
internal/licenses: allow overriding links to licenses
The HPND license has been retired, but should still be
considered valid for use. opensource.org changed the url
that hosts the license, and it doesn't appear to follow
any specific pattern, so we need to keep an override mapping.
Fixes golang/go#76119
Change-Id: I554781021acc599785c8840f404bd01c6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/728260
Reviewed-by: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
| -rw-r--r-- | internal/licenses/licenses.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/licenses/licenses.go b/internal/licenses/licenses.go index 5a1f8d07..2a685967 100644 --- a/internal/licenses/licenses.go +++ b/internal/licenses/licenses.go @@ -191,6 +191,14 @@ var ( "Zlib", } + // licenseURLOverrides provides a mapping from a license identifier to its + // correct URL. This is used for licenses where the URL has changed or does + // not follow the standard pattern. + licenseURLOverrides = map[string]string{ + // HPND is a retired license, and the URL has changed. + "HPND": "https://opensource.org/license/historical-php", + } + // These aren't technically licenses, but they are recognized by // licensecheck and safe to ignore. ignorableLicenseTypes = map[string]bool{ @@ -278,7 +286,9 @@ func AcceptedLicenses() []AcceptedLicenseInfo { var lics []AcceptedLicenseInfo for _, identifier := range standardRedistributableLicenseTypes { var link string - if nonOSILicenses[identifier] { + if override, ok := licenseURLOverrides[identifier]; ok { + link = override + } else if nonOSILicenses[identifier] { link = fmt.Sprintf("https://spdx.org/licenses/%s.html", identifier) } else { link = fmt.Sprintf("https://opensource.org/licenses/%s", identifier) |
