| 109 | } |
| 110 | |
| 111 | func prepareDocsDirectory() error { |
| 112 | log.Println("Prepare docs directory") |
| 113 | |
| 114 | apiPath := path.Join(docsDirectory, apiSubdir) |
| 115 | |
| 116 | err := os.RemoveAll(apiPath) |
| 117 | if err != nil { |
| 118 | return xerrors.Errorf(`os.RemoveAll failed for "%s": %w`, apiPath, err) |
| 119 | } |
| 120 | |
| 121 | err = os.MkdirAll(apiPath, 0o755) |
| 122 | if err != nil { |
| 123 | return xerrors.Errorf(`os.MkdirAll failed for "%s": %w`, apiPath, err) |
| 124 | } |
| 125 | return nil |
| 126 | } |
| 127 | |
| 128 | func writeDocs(sections [][]byte) error { |
| 129 | log.Println("Write docs to destination") |