docs: improve plugins page (#4494)

This commit is contained in:
Ludovic Fernandez 2024-03-13 13:48:59 +01:00 committed by GitHub
parent 2a1afc14cb
commit eaf3ff0741
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 45 additions and 7 deletions

View file

@ -2,6 +2,7 @@ package main
import (
"fmt"
"os"
"path/filepath"
"reflect"
"sort"
@ -17,6 +18,20 @@ import (
const listItemPrefix = "list-item-"
func getExampleSnippets() (*SettingSnippets, error) {
reference, err := os.ReadFile(".golangci.reference.yml")
if err != nil {
return nil, fmt.Errorf("can't read .golangci.reference.yml: %w", err)
}
snippets, err := extractExampleSnippets(reference)
if err != nil {
return nil, fmt.Errorf("can't extract example snippets from .golangci.reference.yml: %w", err)
}
return snippets, nil
}
func getLintersListMarkdown(enabled bool) string {
linters, err := readJSONFile[[]*types.LinterWrapper](filepath.Join("assets", "linters-info.json"))
if err != nil {