doc

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 7 Imported by: 0 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 doc prints declarations with their doc comments, as ant doc does (spec/doc.md).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exported

func Exported(d ast.Decl) bool

Exported reports whether a declaration is exported.

func Sig

func Sig(d ast.Decl) string

Sig is a declaration's signature as written.

func Suggest

func Suggest(decls []ast.Decl, name string, namespaceDocs map[string]string) string

Suggest is what to look at instead when name names nothing among decls (spec/doc.md section 1): the declarations of other owners with its member name, else the names nearest to it, else, for Owner.name with a known owner, the owner's listing; "" when there is nothing to suggest.

Types

type Printer

type Printer struct {
	Color bool
}

Printer renders documentation, preserving source line breaks and spacing. Color highlights signatures and examples and emphasizes namespace headings; the zero value prints no escapes.

func (*Printer) Print

func (p *Printer) Print(w io.Writer, decls []ast.Decl, name string, namespaceDocs map[string]string) bool

Print prints what name names among decls: a declaration with its doc, a namespace's section label from namespaceDocs, and the signatures a namespace or a type holds. It reports whether name named anything. A name is matched without regard to case, and Owner.name names a member.

func (*Printer) PrintDoc

func (p *Printer) PrintDoc(w io.Writer, sig, doc string)

PrintDoc prints a declaration's signature and, indented, its doc.

func (*Printer) PrintIndented

func (p *Printer) PrintIndented(w io.Writer, doc string)

PrintIndented prints a doc indented by four spaces, preserving source line breaks and spacing. Indented code is highlighted when Color is set.

func (*Printer) PrintSignature

func (p *Printer) PrintSignature(w io.Writer, sig string)

PrintSignature prints a signature as written, highlighted when Color is set.

Jump to

Keyboard shortcuts

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