Skip to content

Commit

Permalink
Improve formatting of errors in log output from licenses csv
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Percival committed Nov 7, 2019
1 parent c70fe60 commit 0916978
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package main
import (
"encoding/csv"
"os"
"strings"

"github.com/golang/glog"
"github.com/google/trillian/scripts/licenses/licenses"
Expand Down Expand Up @@ -58,18 +59,18 @@ func csvMain(_ *cobra.Command, args []string) error {
licenseName := "Unknown"
if lib.LicensePath != "" {
// Find a URL for the license file, based on the URL of a remote for the Git repository.
var errs []error
var errs []string
for _, remote := range gitRemotes {
url, err := licenses.GitFileURL(lib.LicensePath, remote)
if err != nil {
errs = append(errs, err)
errs = append(errs, err.Error())
continue
}
licenseURL = url.String()
break
}
if licenseURL == "Unknown" {
glog.Errorf("Error discovering URL for %q: %v", lib.LicensePath, errs)
glog.Errorf("Error discovering URL for %q:\n- %s", lib.LicensePath, strings.Join(errs, "\n- "))
}
licenseName, _, err = classifier.Identify(lib.LicensePath)
if err != nil {
Expand Down

0 comments on commit 0916978

Please sign in to comment.