Skip to content

Commit 416b82a

Browse files
committed
review: default exclusions
1 parent f60613e commit 416b82a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Diff for: scripts/website/expand_templates/exclusions.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"github.com/golangci/golangci-lint/scripts/website/types"
1010
)
1111

12-
func getDefaultExclusions() string {
12+
func getDefaultExclusions() (string, error) {
1313
defaultExcludePatterns, err := readJSONFile[[]types.ExcludePattern](filepath.Join("assets", "default-exclusions.json"))
1414
if err != nil {
15-
panic(err)
15+
return "", err
1616
}
1717

1818
bufferString := bytes.NewBufferString("")
@@ -26,5 +26,5 @@ func getDefaultExclusions() string {
2626
_, _ = fmt.Fprintf(bufferString, "- why: %s\n", pattern.Why)
2727
}
2828

29-
return bufferString.String()
29+
return bufferString.String(), nil
3030
}

Diff for: scripts/website/expand_templates/main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,19 @@ func buildTemplateContext() (map[string]string, error) {
144144
return nil, fmt.Errorf("failed to get the latest version: %w", err)
145145
}
146146

147+
exclusions, err := getDefaultExclusions()
148+
if err != nil {
149+
return nil, fmt.Errorf("default exclusions: %w", err)
150+
}
151+
147152
return map[string]string{
148153
"LintersExample": snippets.LintersSettings,
149154
"ConfigurationExample": snippets.ConfigurationFile,
150155
"LintersCommandOutputEnabledOnly": helps.Enable,
151156
"LintersCommandOutputDisabledOnly": helps.Disable,
152157
"EnabledByDefaultLinters": getLintersListMarkdown(true),
153158
"DisabledByDefaultLinters": getLintersListMarkdown(false),
154-
"DefaultExclusions": getDefaultExclusions(),
159+
"DefaultExclusions": exclusions,
155160
"ThanksList": getThanksList(),
156161
"RunHelpText": helps.Help,
157162
"ChangeLog": string(changeLog),

0 commit comments

Comments
 (0)