From 89a90d6ea15b9e881c03783e26cff2f256d423ec Mon Sep 17 00:00:00 2001 From: Malte Spielberger Date: Mon, 12 Dec 2022 14:34:48 +0100 Subject: [PATCH 1/2] Change handling, when no licence was found --- detector/detector.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/detector/detector.go b/detector/detector.go index f1c2d46..d41024f 100644 --- a/detector/detector.go +++ b/detector/detector.go @@ -25,6 +25,7 @@ import ( "fmt" "io" "io/ioutil" + "log" "path/filepath" "regexp" "strings" @@ -170,7 +171,8 @@ func doDetectLicences(licenceRegex *regexp.Regexp, classifier *licenseclassifier // detect the licence type if the override hasn't provided one if depInfo.LicenceType == "" { if depInfo.LicenceFile == "" { - return nil, fmt.Errorf("no licence file found for %s. Add an override entry with licence type to continue.", depInfo.Name) + log.Printf("Skipping %s because no licence was found.", depInfo.Name) + continue } var err error @@ -180,7 +182,8 @@ func doDetectLicences(licenceRegex *regexp.Regexp, classifier *licenseclassifier } if depInfo.LicenceType == "" { - return nil, fmt.Errorf("licence unknown for %s. Add an override entry with licence type to continue.", depInfo.Name) + log.Printf("Skipping %s because no licence was found.", depInfo.Name) + continue } } From d7a6b8b50c57f23455d29d7ec225cc2fc24c7386 Mon Sep 17 00:00:00 2001 From: Malte Spielberger Date: Thu, 15 Dec 2022 11:17:08 +0100 Subject: [PATCH 2/2] Change handling, when no licence type was found --- detector/detector.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/detector/detector.go b/detector/detector.go index d41024f..b7f9a27 100644 --- a/detector/detector.go +++ b/detector/detector.go @@ -171,18 +171,19 @@ func doDetectLicences(licenceRegex *regexp.Regexp, classifier *licenseclassifier // detect the licence type if the override hasn't provided one if depInfo.LicenceType == "" { if depInfo.LicenceFile == "" { - log.Printf("Skipping %s because no licence was found.", depInfo.Name) + log.Printf("Skipping %s because no licence was found.\n", depInfo.Name) continue } var err error depInfo.LicenceType, err = detectLicenceType(classifier, depInfo.LicenceFile) if err != nil { - return nil, fmt.Errorf("failed to detect licence type of %s from %s: %w", depInfo.Name, depInfo.LicenceFile, err) + log.Printf("Failed to detect licence type of %s. Skipping it!\n", depInfo.Name) + //return nil, fmt.Errorf("failed to detect licence type of %s from %s: %w", depInfo.Name, depInfo.LicenceFile, err) } if depInfo.LicenceType == "" { - log.Printf("Skipping %s because no licence was found.", depInfo.Name) + log.Printf("Skipping %s because no licence was found.\n", depInfo.Name) continue } }