func newVendorer()

in cmd/kazel/kazel.go [98:139]


func newVendorer(root, cfgPath string, dryRun bool) (*Vendorer, error) {
	absRoot, err := filepath.Abs(root)
	if err != nil {
		return nil, fmt.Errorf("could not get absolute path: %v", err)
	}
	if !filepath.IsAbs(cfgPath) {
		cfgPath = filepath.Join(absRoot, cfgPath)
	}
	cfg, err := ReadCfg(cfgPath)
	if err != nil {
		return nil, err
	}

	v := Vendorer{
		dryRun:       dryRun,
		root:         absRoot,
		cfg:          cfg,
		newRules:     make(map[string][]*build.Rule),
		managedAttrs: []string{"srcs"},
	}

	builtIn, err := compileSkippedPaths([]string{"^\\.git", "^bazel-*"})
	if err != nil {
		return nil, err
	}

	sp, err := compileSkippedPaths(cfg.SkippedPaths)
	if err != nil {
		return nil, err
	}
	sp = append(builtIn, sp...)
	v.skippedPaths = sp

	sop, err := compileSkippedPaths(cfg.SkippedK8sCodegenPaths)
	if err != nil {
		return nil, err
	}
	v.skippedK8sCodegenPaths = append(sop, sp...)

	return &v, nil

}