doc

package
v0.0.0-...-e8e64b1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package doc renders Go package documentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Pos, End  int32
	Kind      AnnotationKind
	PathIndex int16
}

type AnnotationKind

type AnnotationKind int16
const (
	// Link to export in package specified by Paths[PathIndex] with fragment
	// Text[strings.LastIndex(Text[Pos:End], ".")+1:End].
	LinkAnnotation AnnotationKind = iota

	// Anchor with name specified by Text[Pos:End] or typeName + "." +
	// Text[Pos:End] for type declarations.
	AnchorAnnotation

	// Comment.
	CommentAnnotation

	// Link to package specified by Paths[PathIndex].
	PackageLinkAnnotation

	// Link to builtin entity with name Text[Pos:End].
	BuiltinAnnotation
)

type Code

type Code struct {
	Text        string
	Annotations []Annotation
	Paths       []string
}

type Documentation

type Documentation struct {
	Filenames []string
	Notes     map[string][]*Note
	Doc       string
	Consts    []*Value
	Types     []*Type
	Vars      []*Value
	Funcs     []*Func
	Examples  []*Example
	Truncated bool
}

Documentation is the documentation for an entire package.

type Example

type Example struct {
	Name   string
	Doc    string
	Code   Code
	Play   string
	Output string
}

type File

type File struct {
	Name string
	URL  string
}

type Func

type Func struct {
	Decl     Code
	Pos      Pos
	Doc      string
	Name     string
	Recv     string // actual receiver "T" or "*T"
	Orig     string // original receiver "T" or "*T"
	Examples []*Example
}

type Note

type Note struct {
	Pos  Pos
	UID  string
	Body string
}

type Package

type Package struct {
	Documentation
	Name     string
	Synopsis string
	Imports  []string
}

Package contains package documentation plus some extra information.

func New

func New(modulePath string, src *internal.Directory, ctx *build.Context) (*Package, error)

New computes documentation for the given package.

type Pos

type Pos struct {
	Line int32  // 0 if not valid.
	N    uint16 // number of lines - 1
	File int16  // index in Package.Filenames
}

type Type

type Type struct {
	Doc      string
	Name     string
	Decl     Code
	Pos      Pos
	Consts   []*Value
	Vars     []*Value
	Funcs    []*Func
	Methods  []*Func
	Examples []*Example
}

type Value

type Value struct {
	Decl Code
	Pos  Pos
	Doc  string
}

Jump to

Keyboard shortcuts

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