Debian Codegraph @

spdxexp/license.go

raw symbols SCIP
1 package spdxexpscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/
2
3 import (
4 "stringsscip-go gomod github.com/golang/go/src go1.24 strings/"
5
6 "github.com/github/go-spdx/v2/spdxexp/spdxlicensesscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp/spdxlicenses`/"
7 )
8
9 // activeLicense returns true if the id is an active license.
10 func activeLicensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/activeLicense().(id string) (bool, string) {
11 return spdxlicensesscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp/spdxlicenses`/.IsActiveLicensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp/spdxlicenses`/IsActiveLicense().(id)
12 }
13
14 // ActiveLicense returns true if the id is an active license.
15 func ActiveLicensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/ActiveLicense().(id string) (bool, string) {
16 return activeLicensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/activeLicense().(id)
17 }
18
19 // deprecatedLicense returns true if the id is a deprecated license.
20 func deprecatedLicensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/deprecatedLicense().(id string) (bool, string) {
21 return spdxlicensesscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp/spdxlicenses`/.IsDeprecatedLicensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp/spdxlicenses`/IsDeprecatedLicense().(id)
22 }
23
24 // exceptionLicense returns true if the id is an exception license.
25 func exceptionLicensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/exceptionLicense().(id string) (bool, string) {
26 return spdxlicensesscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp/spdxlicenses`/.IsExceptionscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp/spdxlicenses`/IsException().(id)
27 }
28
29 const (
30 licenseGroupscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseGroup. uint8 = iota
31 versionGroupscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/versionGroup.
32 licenseIndexscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseIndex.
33 )
34
35 type licenseRangescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseRange# struct {
36 licensesscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseRange#licenses. []string
37 locationscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseRange#location. map[uint8]int // licenseGroup, versionGroup, licenseIndex
38 }
39
40 // getLicenseRange returns a range of licenses from licenseRanges
41 func getLicenseRangescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/getLicenseRange().(id string) *licenseRangescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseRange# {
42 simpleID := simplifyLicensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/simplifyLicense().(id)
43 allRanges := spdxlicensesscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp/spdxlicenses`/.LicenseRangesscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp/spdxlicenses`/LicenseRanges().()
44 for i, licenseGrp := range allRanges {
45 for j, versionGrp := range licenseGrp {
46 for k, license := range versionGrp {
47 if simpleID == license {
48 location := map[uint8]int{
49 licenseGroupscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseGroup.: i,
50 versionGroupscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/versionGroup.: j,
51 licenseIndexscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseIndex.: k,
52 }
53 return &licenseRangescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseRange#{
54 licensesscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseRange#licenses.: versionGrp,
55 locationscip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/licenseRange#location.: location,
56 }
57 }
58 }
59 }
60 }
61 return nil
62 }
63
64 func simplifyLicensescip-go gomod github.com/github/go-spdx/v2 . `github.com/github/go-spdx/v2/spdxexp`/simplifyLicense().(id string) string {
65 if stringsscip-go gomod github.com/golang/go/src go1.24 strings/.HasSuffixscip-go gomod github.com/golang/go/src go1.24 strings/HasSuffix().(id, "-or-later") {
66 return id[0 : len(id)-9]
67 }
68 return id
69 }