()
| 21 | } |
| 22 | |
| 23 | func generateMarkdown() { |
| 24 | cfg := config.NewDefaultConfiguration() |
| 25 | entries := make([]MarkdownEntry, 0) |
| 26 | |
| 27 | root := reflect.TypeOf(cfg).Elem() |
| 28 | rootValue := reflect.ValueOf(cfg).Elem() |
| 29 | rootPath := "tinyauth." |
| 30 | |
| 31 | walkAndBuild(root, rootValue, rootPath, &entries, buildMdEntry, buildMdMapEntry, buildMdChildPath) |
| 32 | compiled := compileMd(entries) |
| 33 | |
| 34 | err := os.Remove("config.gen.md") |
| 35 | if err != nil && !errors.Is(err, fs.ErrNotExist) { |
| 36 | slog.Error("failed to remove example env file", "error", err) |
| 37 | os.Exit(1) |
| 38 | } |
| 39 | |
| 40 | err = os.WriteFile("config.gen.md", compiled, 0644) |
| 41 | if err != nil { |
| 42 | slog.Error("failed to write example env file", "error", err) |
| 43 | os.Exit(1) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | func buildMdEntry(child reflect.StructField, childValue reflect.Value, parentPath string, entries *[]MarkdownEntry) { |
| 48 | desc := child.Tag.Get("description") |
no test coverage detected