From fcd90fa78ae4f04b84ee08cfaa500bd10045eb6a Mon Sep 17 00:00:00 2001 From: Vasek - Tom C Date: Fri, 28 Jan 2022 15:27:32 +0100 Subject: [PATCH] Solves #1512 Signed-off-by: Vasek - Tom C --- pkg/pkg.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/pkg.go b/pkg/pkg.go index c3dd2330..0b7abbf6 100644 --- a/pkg/pkg.go +++ b/pkg/pkg.go @@ -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 ) @@ -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 { @@ -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 }