docapiindex

command
v0.2.0-beta.15 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Command docapiindex builds the declaration index scripts/check-doc-api-refs.sh resolves documentation references against, by parsing the Go files it is given rather than matching their text.

printf '%s\0' pkg/a/a.go ... | go run ./scripts/docapiindex symbols
printf '%s\0' pkg/a/a.go ... | go run ./scripts/docapiindex types

The input is a NUL-separated list of Go files on stdin. Each row names the directory of the file that declares it, cleaned as filepath.Dir cleans it (`./pkg/a/a.go` gives `pkg/a`).

symbols prints "<dir> <name> <receiver>" for every exported package-level declaration -- func, const, var and type, `-` in the receiver column -- and for every method with an exported name, its receiver column holding the bare receiver type: the pointer and any type-parameter list dropped.

types prints "<dir> <type>" for every exported type a method can be declared on: aliases (whose methods are their target's) and interfaces (whose methods are not func declarations the symbol index could hold) are left out.

A text match over the same files cannot give these answers exactly: it reads a declaration inside a comment or a raw string as real, it misses one inside a grouped `type ( ... )`, `const ( ... )` or `var ( ... )` block, and a type-parameter list holding a bracket defeats it. A file that does not parse is an error, not a skipped file: a thinner index is a greener check.

Jump to

Keyboard shortcuts

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