codocgen

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package codocgen provides tools for generating code documentation from Go source code. This package analyzes Go packages and produces codoc.Package objects with documentation.

Package codocgen provides tools for generating code documentation from Go source code. This package analyzes Go packages and produces codoc.Package objects with documentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromPath

func FromPath(path string, opts ...Option) (*codoc.Package, error)

FromPath generates documentation for a package at the given path. It analyzes the Go source code in the specified path and returns a codoc.Package containing all the extracted documentation information. Options can be provided to filter what gets included in the documentation.

func RegisterPath

func RegisterPath(path string, opts ...Option) error

RegisterPath registers a package at the given path with the codoc registry. It analyzes the package, generates documentation, and adds it to the global registry. Options can be provided to filter what gets included in the documentation.

Types

type Option

type Option func(*config)

Option is a function type that modifies a config. Options are used to customize the behavior of the documentation generator.

func Exported

func Exported() Option

Exported returns an Option that filters to include only exported functions and structs. Exported items are those that start with an uppercase letter.

func FilterFuncs

func FilterFuncs(fn func(fn codoc.Function) bool) Option

FilterFuncs adds a function filter to the configuration. The filter function takes a Function and returns true if it should be included in the documentation.

func FilterStructs

func FilterStructs(fn func(st codoc.Struct) bool) Option

FilterStructs adds a struct filter to the configuration. The filter function takes a Struct and returns true if it should be included in the documentation.

func WithDoc

func WithDoc() Option

WithDoc returns an Option that filters to include only functions and structs with documentation. This is useful to ensure that only documented code appears in the output.

type PackageError

type PackageError []packages.Error

PackageError represents errors encountered during package loading and analysis. It wraps a slice of packages.Error from the go/packages package.

func (PackageError) Error

func (PackageError) Error() string

Error implements the error interface for PackageError.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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