Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions detector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"path/filepath"
"regexp"
"strings"
Expand Down Expand Up @@ -170,17 +171,20 @@ 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.\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 == "" {
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.\n", depInfo.Name)
continue
}
}

Expand Down