Help us shape the future of Go! Take the 2026 Go Developer Survey

pkgdoc

package
v1.104.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package pkgdoc is a library-ified fork of Go's cmd/doc program that only does what we need for misc/genreadme.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PackageDoc

func PackageDoc(dir, importPath string) ([]byte, error)

PackageDoc generates Markdown documentation for the package in the given directory. importPath is the full Go import path of that package (e.g. "tailscale.com/tsnet"); it's used to render [Symbol] doc links to the right pkg.go.dev URL. If importPath is empty, build.ImportDir's guess is used (typically "." for module-based repos).

Types

type Package

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

func (*Package) Printf

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

func (*Package) ToMarkdown

func (pkg *Package) ToMarkdown(w io.Writer, text string)

ToMarkdown parses the godoc comment text and writes a Markdown rendering to w suitable for a repository README.md: top-level sections become ## headings without per-heading anchor IDs, and [Symbol] doc links resolve to pkg.go.dev, including for symbols in the current package (which the default printer would otherwise emit as bare #Name fragments with no backing anchor).

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

Jump to

Keyboard shortcuts

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