Skip to content

Commit

Permalink
fix: swapped code around to make go-licenses work better with the emb…
Browse files Browse the repository at this point in the history
…ed package

See discussion at #79
  • Loading branch information
jimmale authored and wlynch committed Dec 16, 2021
1 parent ceb2923 commit baa4dc1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions save.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ func init() {
}

func saveMain(_ *cobra.Command, args []string) error {

classifier, err := licenses.NewClassifier(confidenceThreshold)
if err != nil {
return err
}

libs, err := licenses.Libraries(context.Background(), classifier, args...)
if err != nil {
return err
}

if overwriteSavePath {
if err := os.RemoveAll(savePath); err != nil {
return err
Expand All @@ -76,15 +87,6 @@ func saveMain(_ *cobra.Command, args []string) error {
return err
}

classifier, err := licenses.NewClassifier(confidenceThreshold)
if err != nil {
return err
}

libs, err := licenses.Libraries(context.Background(), classifier, args...)
if err != nil {
return err
}
libsWithBadLicenses := make(map[licenses.Type][]*licenses.Library)
for _, lib := range libs {
libSaveDir := filepath.Join(savePath, unvendor(lib.Name()))
Expand Down

0 comments on commit baa4dc1

Please sign in to comment.