skipped 13 lines 14 14 var _ sort.Interface = (*Licenses)(nil) 15 15 16 16 // License represents an SPDX Expression or license value extracted from a packages metadata 17 - // We want to ignore URL and Location since we merge these fields across equal licenses. 17 + // We want to ignore URLs and Location since we merge these fields across equal licenses. 18 18 // A License is a unique combination of value, expression and type, where 19 19 // its sources are always considered merged and additions to the evidence 20 20 // of where it was found and how it was sourced. skipped 5 lines 26 26 Value string `json:"value"` 27 27 SPDXExpression string `json:"spdxExpression"` 28 28 Type license.Type `json:"type"` 29 - URL internal.StringSet `hash:"ignore"` 30 - Location source.LocationSet `hash:"ignore"` 29 + URLs internal.StringSet `hash:"ignore"` 30 + Locations source.LocationSet `hash:"ignore"` 31 31 } 32 32 33 33 type Licenses []License skipped 6 lines 40 40 if l[i].Value == l[j].Value { 41 41 if l[i].SPDXExpression == l[j].SPDXExpression { 42 42 if l[i].Type == l[j].Type { 43 - // While URL and location are not exclusive fields 43 + // While URLs and location are not exclusive fields 44 44 // returning true here reduces the number of swaps 45 45 // while keeping a consistent sort order of 46 46 // the order that they appear in the list initially skipped 22 lines 69 69 Value: value, 70 70 SPDXExpression: spdxExpression, 71 71 Type: license.Declared, 72 - URL : internal.NewStringSet(), 73 - Location : source.NewLocationSet(), 72 + URLs : internal.NewStringSet(), 73 + Locations : source.NewLocationSet(), 74 74 } 75 75 } 76 76 skipped 7 lines 84 84 Value: value, 85 85 SPDXExpression: spdxExpression, 86 86 Type: t, 87 - URL : internal.NewStringSet(), 88 - Location : source.NewLocationSet(), 87 + URLs : internal.NewStringSet(), 88 + Locations : source.NewLocationSet(), 89 89 } 90 90 } 91 91 skipped 17 lines 109 109 func NewLicenseFromLocations(value string, locations ...source.Location) License { 110 110 l := NewLicense(value) 111 111 for _, loc := range locations { 112 - l.Location .Add(loc) 112 + l.Locations .Add(loc) 113 113 } 114 114 return l 115 115 } skipped 2 lines 118 118 l := NewLicense(value) 119 119 for _, u := range urls { 120 120 if u != "" { 121 - l.URL .Add(u) 121 + l.URLs .Add(u) 122 122 } 123 123 } 124 124 return l skipped 16 lines 141 141 return nil, fmt.Errorf("cannot merge licenses with different hash") 142 142 } 143 143 144 - s.URL .Add(l.URL .ToSlice()...) 145 - if s.Location .Empty() && l.Location .Empty() { 144 + s.URLs .Add(l.URLs .ToSlice()...) 145 + if s.Locations .Empty() && l.Locations .Empty() { 146 146 return &s, nil 147 147 } 148 148 149 - s.Location .Add(l.Location .ToSlice()...) 149 + s.Locations .Add(l.Locations .ToSlice()...) 150 150 return &s, nil 151 151 } 152 152