From 6f5095ec1974fc4c95fcbcfef49262f9dd3dabbc Mon Sep 17 00:00:00 2001 From: Vasek - Tom C Date: Fri, 28 Jan 2022 22:46:36 +0100 Subject: [PATCH] Fix permissions issue and doc generation issue Signed-off-by: Vasek - Tom C --- cmd/dagger/cmd/doc.go | 8 +++++++- pkg/pkg.go | 9 ++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cmd/dagger/cmd/doc.go b/cmd/dagger/cmd/doc.go index eee6c296..48025d42 100644 --- a/cmd/dagger/cmd/doc.go +++ b/cmd/dagger/cmd/doc.go @@ -338,7 +338,9 @@ func walkStdlib(ctx context.Context, output, format string) { return err } - if p == "." || d.Name() == pkg.AlphaModule || !d.IsDir() || d.Name() == "cue.mod" { + // Ignore useless embedded files + if p == "." || d.Name() == pkg.AlphaModule || !d.IsDir() || d.Name() == "cue.mod" || + strings.Contains(p, "cue.mod") || strings.Contains(p, "tests") { return nil } @@ -357,6 +359,10 @@ func walkStdlib(ctx context.Context, output, format string) { lg.Warn().Str("package", p).Err(err).Msg("ignoring") return nil } + if strings.Contains(err.Error(), "cannot find package") { + lg.Warn().Str("package", p).Err(err).Msg("ignoring") + return nil + } return err } diff --git a/pkg/pkg.go b/pkg/pkg.go index 8bfde31e..8ed20881 100644 --- a/pkg/pkg.go +++ b/pkg/pkg.go @@ -133,11 +133,10 @@ func extractModules(dest string) error { return err } - info, err := fs.Stat(FS, p) - if err != nil { - return err - } - return os.WriteFile(overlayPath, contents, info.Mode().Perm()) + // Give exec permission on embedded file to freely use shell script + // Exclude permission linter + //nolint + return os.WriteFile(overlayPath, contents, 0700) }) }