From c42498d85769b5bdafe1120d16a1cb911e147c94 Mon Sep 17 00:00:00 2001 From: Rohit Nayak Date: Sun, 15 Dec 2024 15:38:07 +0100 Subject: [PATCH] if file doesn't exist don't try to replace workdir Signed-off-by: Rohit Nayak --- go/cmd/internal/docgen/docgen.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/go/cmd/internal/docgen/docgen.go b/go/cmd/internal/docgen/docgen.go index 0aa641a05f5..13b55810a36 100644 --- a/go/cmd/internal/docgen/docgen.go +++ b/go/cmd/internal/docgen/docgen.go @@ -171,6 +171,12 @@ func restructure(rootDir string, dir string, name string, commands []*cobra.Comm continue } f := filepath.Join(dir, fullCmdFilename+".md") + if _, err := os.Stat(f); err != nil { + if errors.Is(err, fs.ErrNotExist) { + continue + } + return fmt.Errorf("failed to get file info for %s: %w", f, err) + } if err := anonymizeHomedir(f); err != nil { return fmt.Errorf("failed to anonymize homedir in help text for command %s: %w", f, err) }