Skip to content

Commit

Permalink
Solves #1512
Browse files Browse the repository at this point in the history
Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
  • Loading branch information
TomChv committed Jan 28, 2022
1 parent cb3a6ed commit fcd90fa
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pkg/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

var (
// FS contains the filesystem of the stdlib.
//go:embed */**/*.cue */**/**/*.cue
//go:embed */**/*.cue */**/**/*.cue */**/*.sh
FS embed.FS
)

Expand Down Expand Up @@ -112,6 +112,17 @@ func Vendor(ctx context.Context, p string) error {
return nil
}

func isAllowedExt(ext string) bool {
// List of allowed extension to vendor in
allowedExtension := []string{".cue", ".sh"}
for _, v := range allowedExtension {
if v == ext {
return true
}
}
return false
}

func extractModules(dest string) error {
return fs.WalkDir(FS, ".", func(p string, entry fs.DirEntry, err error) error {
if err != nil {
Expand All @@ -122,7 +133,7 @@ func extractModules(dest string) error {
return nil
}

if filepath.Ext(entry.Name()) != ".cue" {
if !isAllowedExt(filepath.Ext(entry.Name())) {
return nil
}

Expand Down

0 comments on commit fcd90fa

Please sign in to comment.