Skip to content

Commit

Permalink
cmd/makedocs: add enabled/disabled by default info (go-critic#795)
Browse files Browse the repository at this point in the history
Split table into 3 categories and add
enabled/disabled by default info.

Signed-off-by: Iskander Sharipov <[email protected]>
  • Loading branch information
quasilyte authored Feb 3, 2019
1 parent 66e5832 commit 6bce9d0
Show file tree
Hide file tree
Showing 4 changed files with 457 additions and 251 deletions.
15 changes: 13 additions & 2 deletions cmd/makedocs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ const (
)

func main() {
tmpl := template.Must(template.ParseFiles(templatesPath + "overview.md.tmpl"))
tmpl := parseTemplate(
"overview.md.tmpl",
"checker_tr.partial.tmpl")

buf := bytes.Buffer{}
err := tmpl.Execute(&buf, struct {
err := tmpl.ExecuteTemplate(&buf, "overview", struct {
Checkers []*lintpack.CheckerInfo
}{
Checkers: lintpack.GetCheckersInfo(),
Expand All @@ -30,3 +33,11 @@ func main() {
log.Fatalf("write output file: %v", err)
}
}

func parseTemplate(names ...string) *template.Template {
paths := make([]string, len(names))
for i := range names {
paths[i] = templatesPath + names[i]
}
return template.Must(template.ParseFiles(paths...))
}
Loading

0 comments on commit 6bce9d0

Please sign in to comment.