Source File
doc.go
Belonging Package
go/doc
package doc
import (
)
func ( *ast.Package, string, Mode) *Package {
var reader
.readPackage(, )
.computeMethodSets()
.cleanupTypes()
return &Package{
Doc: .doc,
Name: .Name,
ImportPath: ,
Imports: sortedKeys(.imports),
Filenames: .filenames,
Notes: .notes,
Bugs: noteBodies(.notes["BUG"]),
Consts: sortedValues(.values, token.CONST),
Types: sortedTypes(.types, &AllMethods != 0),
Vars: sortedValues(.values, token.VAR),
Funcs: sortedFuncs(.funcs, true),
}
}
var (
= make(map[string]*ast.File)
[]*ast.File
)
for := range {
:= .File([].Pos())
if == nil {
return nil, fmt.Errorf("file files[%d] is not found in the provided file set", )
}
switch := .Name(); {
case strings.HasSuffix(, ".go") && !strings.HasSuffix(, "_test.go"):
[] = []
case strings.HasSuffix(, "_test.go"):
= append(, [])
default:
return nil, fmt.Errorf("file files[%d] filename %q does not have a .go extension", , )
}
}
, := ast.NewPackage(, , simpleImporter, nil) // Ignore errors that can happen due to unresolved identifiers.
:= New(, , )
classifyExamples(, Examples(...))
return , nil
}
![]() |
The pages are generated with Golds v0.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. |