refactor: reduce use of pointers in particular, Source can no longer be nil. Instantiate a Source with an Importer of All instead
1 file changed, 9 insertions(+), 4 deletions(-)
changed files
M internal/config/importer-type.go → internal/config/importer-type.go
@@ -9,10 +9,11 @@ type ImporterType int const ( - All ImporterType = iota - 1 - UnknownType - Packages + Packages ImporterType = 1 << iota Options + + UnknownType = -1 + All = Packages | Options ) func (i ImporterType) String() string {@@ -26,6 +27,10 @@ return "options" } return fmt.Sprintf("Type(%d)", i) +} + +func (i ImporterType) Includes(m ImporterType) bool { + return i&m == m } func (i ImporterType) Singular() string {@@ -59,6 +64,6 @@ return err } -func (i *ImporterType) MarshalText() ([]byte, error) { +func (i ImporterType) MarshalText() ([]byte, error) { return []byte(i.String()), nil }