publicapi

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 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 publicapi reports every exported identifier of a public package that refers to a type from an internal/ package: a program outside the module can read such a type but cannot name or build it, and the internal package becomes part of the public contract. The public package gives itself its own type instead and converts at its edge.

An import is internal when a path element of it is "internal". An import alone is never reported, and neither is one used only inside function bodies; a dot import of an internal package is, since its names read as the package's own. Read are the exported API's types: an exported type's exported fields, embedded types, interface methods, what it is declared as or aliased to, and its type parameters' constraints; the parameters, results and constraints of exported functions and of exported methods on exported types; and the declared types of exported variables and constants. An exported variable or constant with no declared type whose value names an internal package is reported too, since syntax alone cannot tell what the value's type is. A type declared unexported in the same package that the API reaches is followed to its exported fields, embedded types and exported methods, which the API shows through it.

Like the other rules of codecheck it reads syntax alone, with no type checking, so it is a check, not a proof.

Index

Constants

This section is empty.

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 exported identifier, or one dot import, that shows an internal type.

func Check

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

Check reports, sorted by file and line, each exported identifier of the package in dir that refers to a type from an internal package, one finding per identifier and internal type, and each dot import of an internal package. root is the module's directory, module its path, dir the package's directory relative to root and files its Go files; test files are skipped. A file that does not parse is an error.

Jump to

Keyboard shortcuts

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