Skip to content

Commit

Permalink
Test if vendor dir exists before stripping non-go file
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy Baukema committed Mar 6, 2024
1 parent 773ccb6 commit dfc47cc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/otiai10/copy"
)

const VERSION = "v0.0.20"
const VERSION = "v0.0.21"

// TODO: implement non-debug mode
// TODO: implement versioning
Expand Down Expand Up @@ -206,9 +206,14 @@ func packageMainFile(mainFile string, packageDate string) error {
return err
}

err = deleteFilesWithoutGoExtension(copyDir + string(os.PathSeparator) + "vendor")
if err != nil {
return err
_, vendorPathErr := os.Stat(copyDir + "/vendor")
hasVendorDir := vendorPathErr == nil

if hasVendorDir {
err = deleteFilesWithoutGoExtension(copyDir + string(os.PathSeparator) + "vendor")
if err != nil {
return err
}
}

err = updateVeracodeJson(mainFile, parentDir, copyDir)
Expand Down

0 comments on commit dfc47cc

Please sign in to comment.