Skip to content

Commit b1518c6

Browse files
committed
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 <[email protected]> kokoro-CI: kokoro <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent c3ac91d commit b1518c6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

internal/licenses/licenses.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ var (
191191
"Zlib",
192192
}
193193

194+
// licenseURLOverrides provides a mapping from a license identifier to its
195+
// correct URL. This is used for licenses where the URL has changed or does
196+
// not follow the standard pattern.
197+
licenseURLOverrides = map[string]string{
198+
// HPND is a retired license, and the URL has changed.
199+
"HPND": "https://opensource.org/license/historical-php",
200+
}
201+
194202
// These aren't technically licenses, but they are recognized by
195203
// licensecheck and safe to ignore.
196204
ignorableLicenseTypes = map[string]bool{
@@ -278,7 +286,9 @@ func AcceptedLicenses() []AcceptedLicenseInfo {
278286
var lics []AcceptedLicenseInfo
279287
for _, identifier := range standardRedistributableLicenseTypes {
280288
var link string
281-
if nonOSILicenses[identifier] {
289+
if override, ok := licenseURLOverrides[identifier]; ok {
290+
link = override
291+
} else if nonOSILicenses[identifier] {
282292
link = fmt.Sprintf("https://spdx.org/licenses/%s.html", identifier)
283293
} else {
284294
link = fmt.Sprintf("https://opensource.org/licenses/%s", identifier)

0 commit comments

Comments
 (0)