diff options
| author | Russ Cox <rsc@golang.org> | 2021-02-24 18:56:20 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2021-03-12 19:58:10 +0000 |
| commit | 7fe51e8c4ab43b080b824b9c947b2a76c7a9845c (patch) | |
| tree | 4b3f63a76edf21115d0029ae5063559ab4d11238 /_content/doc/tutorial/call-module-code.html | |
| parent | a4e42960dc92502cc02a38c4a5d3ea809c32440b (diff) | |
| download | go-x-website-7fe51e8c4ab43b080b824b9c947b2a76c7a9845c.tar.xz | |
internal/godoc: split package docs into new package pkgdoc [generated]
Isolate package docs scanning and extraction into a new package.
Generated by script below.
[git-generate]
cd internal/godoc
rf '
# We want to end up with each package having its own toFS,
# but to keep each step leaving a valid package, export toFS as ToFSPath
# so it can be used as pkgdoc.ToFSPath after the move.
# We will rewrite the uses left behind after the move.
mv toFS ToFSPath
mv newDirTree newDir
mv Directory Dir
mv Dir.listing Dir.List
mv Dir.lookup Dir.Lookup
mv \
ToFSPath \
Dir \
Dir.Name \
DirList \
DirEntry \
DirEntry.Name \
Dir.Lookup \
Dir.List \
newDir \
isPkgFile \
isPkgDir \
Dir.walk \
walkDirs \
parseFile \
parseFiles \
linePrefix \
replaceLinePrefixCommentsWithBlankLine \
dir.go
mv stripExampleSuffix TrimExampleSuffix
mv splitExampleName SplitExampleName
mv poorMansImporter simpleImporter
mv dirtrees_test.go dir_test.go
mv \
DocTree \
NewDocTree \
PageInfo \
PageInfo.IsEmpty \
PageInfoMode \
NoFiltering \
modeNames \
PageInfoMode.String \
GetPageInfoMode \
DocTree.GetPageInfo \
DocTree.includePath \
simpleImporter \
packageExports \
funcsByName \
funcsByName.Len \
funcsByName.Swap \
funcsByName.Less \
collectExamples \
globalNames \
addNames \
SplitExampleName \
TrimExampleSuffix \
startsWithUppercase \
doc.go
mv \
TestIgnoredGoFiles \
TestIssue5247 \
doc_test.go
mv dir.go dir_test.go doc.go doc_test.go golang.org/x/website/internal/pkgdoc
# Add a new toFS and rewrite the uses left behind.
add server.go:/^\)/ \
// toFS returns the io/fs name for path (no leading slash). \
func toFS(name string) string { \
if name == "/" { \
return "." \
} \
return path.Clean(strings.TrimPrefix(name, "/")) \
}
ex {
import "golang.org/x/website/internal/pkgdoc"
var x string
pkgdoc.ToFSPath(x) -> toFS(x)
}
'
rm dirtrees.go parser.go
cd ../pkgdoc
rf '
# Finish toFS split
mv ToFSPath toFS
# Clean up API for package pkgdoc
mv PageInfo Page
mv DocTree.GetPageInfo Doc.Page
mv DocTree Docs
mv NewDocTree NewDocs
mv PageInfoMode Mode
mv GetPageInfoMode ParseMode
mv NoFiltering ModeAll
mv FlatDir ModeFlat
mv AllMethods ModeMethods
mv ShowSource ModeSrc
mv NoTypeAssoc ModeBuiltin
'
Change-Id: I24384f40739af286c528beb06aa153843005a870
Reviewed-on: https://go-review.googlesource.com/c/website/+/296380
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to '_content/doc/tutorial/call-module-code.html')
0 files changed, 0 insertions, 0 deletions
