kubernetes/cmd/import-boss/main.go

const rulesFileName

const goModFile

func main() {}

func loadPkgs(patterns ...string) ([]*packages.Package, error) {}

func massage(in []*packages.Package) []*packages.Package {}

func unmassage(str string) string {}

type ImportBoss

func newBoss(pkgs []*packages.Package) *ImportBoss {}

func hasTestFiles(files []string) bool {}

func (boss *ImportBoss) Verify(pkg *packages.Package) []error {}

// packageDir tries to figure out the directory of the specified package.
func packageDir(pkg *packages.Package) string {}

type FileFormat

type Rule

type Disposition

const DepForbidden

const DepAllowed

const DepUnknown

// Evaluate considers this rule and decides if this dependency is allowed.
func (r Rule) Evaluate(imp string) Disposition {}

// recursiveRead collects all '.import-restriction' files, between the current directory,
// and the module root.
func recursiveRead(path string) ([]*FileFormat, error) {}

func readFile(path string) (*FileFormat, error) {}

// isGoModRoot checks if a directory is the root directory for a package
// by checking for the existence of a 'go.mod' file in that directory.
func isGoModRoot(path string) bool {}

// removeLastDir removes the last directory, but leaves the file name
// unchanged. It returns the new path and the removed directory. So:
// "a/b/c/file" -> ("a/b/file", "c")
func removeLastDir(path string) (newPath, removedDir string) {}

func (boss *ImportBoss) verifyRules(pkg *packages.Package, restrictionFiles []*FileFormat) []error {}

func uniq(slices ...[]string) []string {}

func hasPathPrefix(path, prefix string) bool {}

func transitiveImports(pkg *packages.Package) ([]string, []string) {}

func dfsImports(dest *[]string, seen map[string]bool, p *packages.Package) {}

// verifyInverseRules checks that all packages that import a package are allowed to import it.
func (boss *ImportBoss) verifyInverseRules(pkg *packages.Package, restrictionFiles []*FileFormat) []error {}

func transitiveClosure(in map[string][]string) map[string][]string {}