package godoc

import "git.sr.ht/~sircmpwn/gddo/internal/godoc"

Package godoc is for rendering Go documentation.

Index

Variables

var ErrInvalidEncodingType = fmt.Errorf("want initial bytes to be %q but they aren't", fastEncodingType)

ErrInvalidEncodingType is returned when the data to DecodePackage has an invalid encoding type.

var TypesToGenerate = []any{&encPackage{}}

Used by the gen program to generate encodings for unexported types.

Types

type File

type File struct {
	Name string // full file pathname relative to zip content directory
	AST  *ast.File
}

A File contains everything needed about a source file to render documentation.

type Package

type Package struct {
	Fset *token.FileSet
	// contains filtered or unexported fields
}

A Package contains package-level information needed to render Go documentation.

func DecodePackage

func DecodePackage(data []byte) (*Package, error)

DecodePackage decodes a byte slice encoded with Package.Encode into a Package.

func NewPackage

func NewPackage() *Package

NewPackage returns a new Package.

func (*Package) AddFile

func (p *Package) AddFile(f *ast.File, removeNodes bool)

AddFile adds a file to the Package. After it returns, the contents of the ast.File are unsuitable for anything other than the methods of this package.

func (*Package) Encode

func (p *Package) Encode() ([]byte, error)

Encode encodes a Package into a byte slice.

Source Files

encode.go encode_ast.gen.go godoc.go

Directories

PathSynopsis
internal/godoc/codecPackage codec implements the general-purpose part of an encoder for Go values.
Version
v0.0.0-20240124133021-55358d4d592d (latest)
Published
Jan 24, 2024
Platform
linux/amd64
Imports
8 packages
Last checked
1 day ago

Tools for package owners.