Skip to content

Commit

Permalink
Merge pull request #57 from LK4D4/warn_non_go_unused
Browse files Browse the repository at this point in the history
cleanup packages which does not contain go files
  • Loading branch information
LK4D4 authored Sep 19, 2017
2 parents 9909bb2 + 839e28f commit a6e196d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,20 @@ func cleanVendor(vendorDir string, realDeps []*build.Package) error {
if err != nil {
return err
}
// remove licenses if it's only files
var onlyLicenses = true
// remove whole dir if there is only non-go files
// keep whitelisted, though
var onlyNonGoFile = true
for _, fi := range lst {
if !isLicenseFile(fi.Name()) {
onlyLicenses = false
relPath, err := filepath.Rel(vendorDir, filepath.Join(p, fi.Name()))
if err != nil {
return err
}
if cleanWhitelist.matchString(relPath) || fi.IsDir() || isGoFile(fi.Name()) {
onlyNonGoFile = false
break
}
}
if !onlyLicenses {
if !onlyNonGoFile {
continue
}
// remove all directories if they're not in dependency paths
Expand Down

0 comments on commit a6e196d

Please sign in to comment.