MCPcopy Index your code
hub / github.com/coder/coder / loadMarkdownSections

Function loadMarkdownSections

scripts/apidocgen/postprocess/main.go:94–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92}
93
94func loadMarkdownSections() ([][]byte, error) {
95 log.Printf("Read the md-file-single: %s", inMdFileSingle)
96 mdFile, err := os.ReadFile(inMdFileSingle)
97 if err != nil {
98 return nil, xerrors.Errorf("can't read the md-file-single: %w", err)
99 }
100 log.Printf("Read %dB", len(mdFile))
101
102 sections := bytes.Split(mdFile, sectionSeparator)
103 if len(sections) < 2 {
104 return nil, xerrors.Errorf("At least 1 section is expected: %w", err)
105 }
106 sections = sections[1:] // Skip the first element which is the empty byte array
107 log.Printf("Loaded %d sections", len(sections))
108 return sections, nil
109}
110
111func prepareDocsDirectory() error {
112 log.Println("Prepare docs directory")

Callers 1

mainFunction · 0.85

Calls 2

ReadFileMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected