improve initClassifier

This commit is contained in:
yp05327 2023-12-01 01:03:31 +00:00
parent 13867800c5
commit c5296f449c

View File

@ -67,18 +67,18 @@ func initClassifier() error {
return err
}
licenseNameCount := make(map[string]int)
existLicense := make(container.Set[string])
if len(licenseFiles) > 0 {
for _, licenseFile := range licenseFiles {
licenseName := ConvertLicenseName(licenseFile)
if existLicense.Contains(licenseName) {
continue
}
existLicense.Add(licenseName)
data, err := options.License(licenseFile)
if err != nil {
return err
}
licenseName := ConvertLicenseName(licenseFile)
licenseNameCount[licenseName]++
if licenseNameCount[licenseName] > 1 {
continue
}
classifier.AddContent("License", licenseFile, licenseName, data)
}
}