A Package contains package-level information needed to render Go documentation.
encPackage.Files[]*FileencPackage.ModulePackagePathsmap[string]boolFset*token.FileSetencPackageencPackagerenderCalledbool
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.
DocInfo returns information extracted from the package's documentation.
This destroys p's AST; do not call any methods of p after it returns.
Encode encodes a Package into a byte slice.
During its operation, Encode modifies the AST,
but it restores it to a state suitable for
rendering before it returns.
Render renders the documentation for the package.
Rendering destroys p's AST; do not call any methods of p after it returns.
docPackage computes and returns a doc.Package.
(*T) fastEncode() (_ []byte, err error)
renderOptions returns a RenderOptions for p.
func DecodePackage(data []byte) (_ *Package, err error)
func NewPackage(fset *token.FileSet, modPaths map[string]bool) *Package
func fastDecodePackage(data []byte) (_ *Package, err error)
func golang.org/x/pkgsite/internal/frontend.getHTML(ctx context.Context, u *internal.Unit, docPkg *Package, nameToVersion map[string]string) (_ *dochtml.Parts, err error)
func golang.org/x/pkgsite/internal/frontend.renderDocParts(ctx context.Context, u *internal.Unit, docPkg *Package, nameToVersion map[string]string) (_ *dochtml.Parts, err error)
func golang.org/x/pkgsite/internal/frontend.sourceFiles(u *internal.Unit, docPkg *Package) []*frontend.File
encPackage holds the fields of Package that can be directly encoded.
If you add any fields, run go generate on this package.
If you remove a field, you will have to hand-edit encode_ast.go
just to make this package compile before running go generate.
Do not remove the field name from the "Fields of" comment, however,
or existing encoded data will decode incorrectly.
If you rename a field, the field's values in existing encoded
data will be lost. Renaming a field is like deleting the old field
and adding a new one.
Files[]*FileModulePackagePathsmap[string]bool
func decode_encPackage(d *codec.Decoder, p **encPackage)
func encode_encPackage(e *codec.Encoder, x *encPackage)
Package-Level Functions (total 218, in which 3 are exported)
DecodPackage decodes a byte slice encoded with Package.Encode into a Package.
NewPackage returns a new Package with the given fset and set of module package paths.
RenderFromUnit is a convenience function that first decodes the source
in the unit, which must exist, and then calls Render.
removeUnusedASTNodes removes parts of the AST not needed for documentation.
It doesn't remove unexported consts, vars or types, although it probably could.
sinceVersionFunc returns a func that reports the version when the symbol
with name was first introduced. nameToVersion is a map of symbol name to
the first version that symbol name was seen in the package.
If the version when the symbol name was first introduced is the earliest
version in nameToVersion, an empty string is returned. This is because we
don't want to display that information on the main page to reduce clutter.
Package-Level Variables (total 4, all are exported)
ErrInvalidEncodingType is returned when the data to DecodePackage has an
invalid encoding type.
MaxDocumentationHTML is a limit on the rendered documentation HTML size.
The current limit of is based on the largest packages that
pkg.go.dev has encountered. See https://golang.org/issue/40576.
It is a variable for testing.
Used by the gen program to generate encodings for unexported types.
Package-Level Constants (total 5, in which 1 are exported)
Exported for tests.
The encoding type identifies the encoding being used, to distinguish them
when reading from the DB.
The encoding type identifies the encoding being used, to distinguish them
when reading from the DB.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.