Skip to content

Commit

Permalink
Merge pull request #34 from Songmu/skipexecutable
Browse files Browse the repository at this point in the history
skip executables from auto collected resources
  • Loading branch information
Songmu committed Aug 17, 2022
2 parents 3667b6e + 5dc33e5 commit 1f6fa2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions goxz.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ func (gx *goxz) initDest() error {
return nil
}

var resourceReg = regexp.MustCompile(`(?i)^(?:readme|license|credit|install|changelog)`)
var (
resourceReg = regexp.MustCompile(`(?i)^(?:readme|license|credit|install|changelog)`)
execExtReg = regexp.MustCompile(`(?i)\.(?:[a-z]*sh|p[ly]|rb|exe|go)$`)
)

func (gx *goxz) gatherResources() ([]string, error) {
dir := gx.projDir
Expand All @@ -191,7 +194,7 @@ func (gx *goxz) gatherResources() ([]string, error) {
continue
}
n := f.Name()
if resourceReg.MatchString(n) && !strings.HasSuffix(n, ".go") {
if resourceReg.MatchString(n) && !execExtReg.MatchString(n) {
ret = append(ret, filepath.Join(dir, n))
}
}
Expand Down
Empty file added testdata/install.sh
Empty file.

0 comments on commit 1f6fa2a

Please sign in to comment.