repouse

package
v0.0.40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package repouse reports the packages that take the port vcs.Repo whole and use three of its methods or fewer: such a package declares its own small interface of the methods it uses, as internal/evidence does, and takes that.

A package takes the port when a non-test file of it mentions the type anywhere but the result list of a function declaration or function literal, which makes or returns one: a parameter, a struct field, an interface embedding, a variable, or the result of a function-typed parameter or field (an opener the package is handed). A package that takes none is not checked, and neither is the port's own package or anything under it.

What a package uses is counted from syntax alone, with no type checking, so this is a check, not a proof. Counted are the port's methods called on a name bound to the port in the same function declaration, closures included, or on a struct field the package declares with the port's type, and, where such a value or an opener of one is handed on (as an argument, as a keyed field of a struct literal, or returned as another interface), the methods of the type it is handed to: every method when another package takes the port whole, since that package is checked on its own. A use the rule cannot follow counts nothing, and the finding names its place.

Index

Constants

View Source
const Enough = 4

Enough is the fewest of the port's methods a package uses to keep taking the port whole.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	Dir     string // package directory, relative to the module, slash-separated
	Message string
}

Finding is one package that takes the port for fewer than Enough methods.

func Check

func Check(root, module string, files map[string][]string, allow map[string]string) ([]Finding, error)

Check reports, sorted by directory, each package of files that takes the port and uses fewer than Enough of its methods, one finding a package. files maps a package directory, relative to root, to its file names; module is the module's path; allow maps a package directory to the reason it may stay as it is. A module with no port has no findings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL