File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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.
3731func 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
You can’t perform that action at this time.
0 commit comments