package doc

import "cmd/internal/doc"

Package doc provides the implementation of the "go doc" subcommand and cmd/doc.

Index

Functions

func Main

func Main(args []string)

Main is the entry point, invoked both by go doc and cmd/doc.

Types

type Dir

type Dir struct {
	// contains filtered or unexported fields
}

A Dir describes a directory holding code by specifying the expected import path and the file system directory.

type Dirs

type Dirs struct {
	// contains filtered or unexported fields
}

Dirs is a structure for scanning the directory tree. Its Next method returns the next Go source directory it finds. Although it can be used to scan the tree multiple times, it only walks the tree once, caching the data it finds.

func (*Dirs) Next

func (d *Dirs) Next() (Dir, bool)

Next returns the next directory in the scan. The boolean is false when the scan is done.

func (*Dirs) Reset

func (d *Dirs) Reset()

Reset puts the scan back at the beginning.

type Package

type Package struct {
	// contains filtered or unexported fields
}

func (*Package) Fatalf

func (pkg *Package) Fatalf(format string, args ...any)

pkg.Fatalf is like log.Fatalf, but panics so it can be recovered in the main do function, so it doesn't cause an exit. Allows testing to work without running a subprocess. The log prefix will be added when logged in main; it is not added here.

func (*Package) Printf

func (pkg *Package) Printf(format string, args ...any)

func (*Package) ToText

func (pkg *Package) ToText(w io.Writer, text, prefix, codePrefix string)

type PackageError

type PackageError string // type returned by pkg.Fatalf.

func (PackageError) Error

func (p PackageError) Error() string

Source Files

dirs.go main.go pkg.go signal_unix.go

Version
v1.25.0-rc.1
Published
Jun 11, 2025
Platform
js/wasm
Imports
29 packages
Last checked
12 seconds ago

Tools for package owners.