-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
Copy pathlicense.go
50 lines (40 loc) · 1.26 KB
/
license.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package types
type LicenseType string
const (
LicenseTypeDpkg LicenseType = "dpkg" // From /usr/share/doc/*/copyright
LicenseTypeHeader LicenseType = "header" // From file headers
LicenseTypeFile LicenseType = "license-file" // From LICENSE, COPYRIGHT, etc.
)
type LicenseCategory string
const (
CategoryForbidden LicenseCategory = "forbidden"
CategoryRestricted LicenseCategory = "restricted"
CategoryReciprocal LicenseCategory = "reciprocal"
CategoryNotice LicenseCategory = "notice"
CategoryPermissive LicenseCategory = "permissive"
CategoryUnencumbered LicenseCategory = "unencumbered"
CategoryUnknown LicenseCategory = "unknown"
)
type LicenseFile struct {
Type LicenseType
FilePath string
PkgName string
Findings LicenseFindings
Layer Layer `json:",omitempty"`
}
type LicenseFindings []LicenseFinding
func (findings LicenseFindings) Len() int {
return len(findings)
}
func (findings LicenseFindings) Swap(i, j int) {
findings[i], findings[j] = findings[j], findings[i]
}
func (findings LicenseFindings) Less(i, j int) bool {
return findings[i].Name < findings[j].Name
}
type LicenseFinding struct {
Category LicenseCategory // such as "forbidden"
Name string
Confidence float64
Link string
}