File tree 2 files changed +9
-4
lines changed
scripts/website/expand_templates
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,10 @@ import (
9
9
"github.com/golangci/golangci-lint/scripts/website/types"
10
10
)
11
11
12
- func getDefaultExclusions () string {
12
+ func getDefaultExclusions () ( string , error ) {
13
13
defaultExcludePatterns , err := readJSONFile [[]types.ExcludePattern ](filepath .Join ("assets" , "default-exclusions.json" ))
14
14
if err != nil {
15
- panic ( err )
15
+ return "" , err
16
16
}
17
17
18
18
bufferString := bytes .NewBufferString ("" )
@@ -26,5 +26,5 @@ func getDefaultExclusions() string {
26
26
_ , _ = fmt .Fprintf (bufferString , "- why: %s\n " , pattern .Why )
27
27
}
28
28
29
- return bufferString .String ()
29
+ return bufferString .String (), nil
30
30
}
Original file line number Diff line number Diff line change @@ -144,14 +144,19 @@ func buildTemplateContext() (map[string]string, error) {
144
144
return nil , fmt .Errorf ("failed to get the latest version: %w" , err )
145
145
}
146
146
147
+ exclusions , err := getDefaultExclusions ()
148
+ if err != nil {
149
+ return nil , fmt .Errorf ("default exclusions: %w" , err )
150
+ }
151
+
147
152
return map [string ]string {
148
153
"LintersExample" : snippets .LintersSettings ,
149
154
"ConfigurationExample" : snippets .ConfigurationFile ,
150
155
"LintersCommandOutputEnabledOnly" : helps .Enable ,
151
156
"LintersCommandOutputDisabledOnly" : helps .Disable ,
152
157
"EnabledByDefaultLinters" : getLintersListMarkdown (true ),
153
158
"DisabledByDefaultLinters" : getLintersListMarkdown (false ),
154
- "DefaultExclusions" : getDefaultExclusions () ,
159
+ "DefaultExclusions" : exclusions ,
155
160
"ThanksList" : getThanksList (),
156
161
"RunHelpText" : helps .Help ,
157
162
"ChangeLog" : string (changeLog ),
You can’t perform that action at this time.
0 commit comments