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) }