func compileConfig()

in processor/config.go [26:58]


func compileConfig(conf *config.Config) (cc *compiledConfig, err error) {
	if conf == nil {
		return nil, nil
	}

	cc = &compiledConfig{
		ignoreTypes:         make([]*regexp.Regexp, len(conf.Processor.IgnoreTypes)),
		ignoreFields:        make([]*regexp.Regexp, len(conf.Processor.IgnoreFields)),
		ignoreGroupVersions: make([]*regexp.Regexp, len(conf.Processor.IgnoreGroupVersions)),
		useRawDocstring:     conf.Processor.UseRawDocstring,
		markers:             conf.Processor.CustomMarkers,
	}

	for i, t := range conf.Processor.IgnoreTypes {
		if cc.ignoreTypes[i], err = regexp.Compile(t); err != nil {
			return nil, fmt.Errorf("failed to compile type regex '%s': %w", t, err)
		}
	}

	for i, f := range conf.Processor.IgnoreFields {
		if cc.ignoreFields[i], err = regexp.Compile(f); err != nil {
			return nil, fmt.Errorf("failed to compile field regex '%s': %w", f, err)
		}
	}

	for i, gv := range conf.Processor.IgnoreGroupVersions {
		if cc.ignoreGroupVersions[i], err = regexp.Compile(gv); err != nil {
			return nil, fmt.Errorf("failed to compile group-version regex '%s': %w", gv, err)
		}
	}

	return
}