Package generator

import "gitlab.com/zoralab/godocgen/internal/generator"

Package generator is the internal package for Godocgen to generate doc data.

Generator holds all the go generate processing functions from the standard Go package. It processes the packages data and return it to Godocgen for its data populations.

Generator package is an internal package which is exclusive only for Godocgen to import from. External third-party importing is prohibited by Go build system.

DocData

type DocData struct {
	Path         string
	Name         string
	Err          error
	Package      *doc.Package
	BuildPackage *build.Package
	FileSet      *token.FileSet
	// contains filtered or unexported fields
}

DocData is the structure for holding a given Go package's documents data.

The data stored within this structure are strictly from go generate standard package.

Func (d *DocData) Configure(path string) (isBad bool)

Configure is to create go/build package data based on the given path.

It returns true when it is done successfully. Otherwise, it returns false for any error or voodoo outcome.

Func (d *DocData) Generate()

Generate is to create the go/doc data from a given Go package.

This function will create the actual go/doc package data based on the DocData.BuildPackage and DocData.FileSet generated from Configure(...). Therefore, one should execute Configure(...) before Generate().