11package config
22
33import (
4- "encoding"
54 "errors"
65 "fmt"
76 "runtime"
8-
9- "gopkg.in/yaml.v3"
107)
118
129var defaultLintersSettings = LintersSettings {
@@ -425,8 +422,6 @@ type ForbidigoSettings struct {
425422 AnalyzeTypes bool `mapstructure:"analyze-types"`
426423}
427424
428- var _ encoding.TextUnmarshaler = & ForbidigoPattern {}
429-
430425// ForbidigoPattern corresponds to forbidigo.pattern and adds mapstructure support.
431426// The YAML field names must match what forbidigo expects.
432427type ForbidigoPattern struct {
@@ -437,30 +432,11 @@ type ForbidigoPattern struct {
437432 // If the entry is a map, then the other fields are set as usual by mapstructure.
438433 patternString string
439434
440- Pattern string `yaml:"p" mapstructure:"p "`
435+ Pattern string `yaml:"p" mapstructure:"pattern "`
441436 Package string `yaml:"pkg,omitempty" mapstructure:"pkg,omitempty"`
442437 Msg string `yaml:"msg,omitempty" mapstructure:"msg,omitempty"`
443438}
444439
445- func (p * ForbidigoPattern ) UnmarshalText (text []byte ) error {
446- // Validation happens when instantiating forbidigo.
447- p .patternString = string (text )
448- return nil
449- }
450-
451- // MarshalString converts the pattern into a string as needed by forbidigo.NewLinter.
452- //
453- // MarshalString is intentionally not called MarshalText,
454- // although it has the same signature
455- // because implementing encoding.TextMarshaler led to infinite recursion when yaml.Marshal called MarshalText.
456- func (p * ForbidigoPattern ) MarshalString () ([]byte , error ) {
457- if p .patternString != "" {
458- return []byte (p .patternString ), nil
459- }
460-
461- return yaml .Marshal (p )
462- }
463-
464440type FunlenSettings struct {
465441 Lines int `mapstructure:"lines"`
466442 Statements int `mapstructure:"statements"`
0 commit comments