Skip to content

Commit 575f954

Browse files
gmlewisalexandear
andauthored
Apply suggestion from @alexandear
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
1 parent 55922b9 commit 575f954

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

tools/extraneous-new/extraneous_new.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,21 @@ type ExtraneousNewPlugin struct {
2727
ignoredMethods map[string]bool
2828
}
2929

30-
// Settings is the configuration for the extraneousnew linter.
31-
type Settings struct {
32-
// IgnoredMethods causes the linter to skip linting individual `Receiver.Methods`.
33-
IgnoredMethods []string `json:"ignored-methods" yaml:"ignored-methods"`
34-
}
35-
3630
// New returns an analysis.Analyzer to use with golangci-lint.
3731
func New(cfg any) (register.LinterPlugin, error) {
38-
settings := Settings{}
32+
ignoredMethods := map[string]bool{}
3933
if cfg != nil {
4034
if data, ok := cfg.(map[string]any); ok {
4135
if ignored, ok := data["ignored-methods"].([]any); ok {
4236
for _, m := range ignored {
4337
if s, ok := m.(string); ok {
44-
settings.IgnoredMethods = append(settings.IgnoredMethods, s)
38+
ignoredMethods[s] = true
4539
}
4640
}
4741
}
4842
}
4943
}
5044

51-
ignoredMethods := map[string]bool{}
52-
for _, m := range settings.IgnoredMethods {
53-
ignoredMethods[m] = true
54-
}
55-
5645
return &ExtraneousNewPlugin{
5746
ignoredMethods: ignoredMethods,
5847
}, nil

0 commit comments

Comments
 (0)