File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
scripts/website/expand_templates Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 ),
You can’t perform that action at this time.
0 commit comments