2013-07-16 22:02:35 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// godoc: Go Documentation Server
|
|
|
|
|
|
|
|
// Web server tree:
|
|
|
|
//
|
|
|
|
// http://godoc/ main landing page
|
|
|
|
// http://godoc/doc/ serve from $GOROOT/doc - spec, mem, etc.
|
|
|
|
// http://godoc/src/ serve files from $GOROOT/src; .go gets pretty-printed
|
|
|
|
// http://godoc/cmd/ serve documentation about commands
|
|
|
|
// http://godoc/pkg/ serve documentation about packages
|
|
|
|
// (idea is if you say import "compress/zlib", you go to
|
|
|
|
// http://godoc/pkg/compress/zlib)
|
|
|
|
//
|
|
|
|
// Command-line interface:
|
|
|
|
//
|
|
|
|
// godoc packagepath [name ...]
|
|
|
|
//
|
|
|
|
// godoc compress/zlib
|
|
|
|
// - prints doc for package compress/zlib
|
|
|
|
// godoc crypto/block Cipher NewCMAC
|
|
|
|
// - prints doc for Cipher and NewCMAC in package crypto/block
|
|
|
|
|
|
|
|
// +build !appengine
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"archive/zip"
|
|
|
|
"bytes"
|
|
|
|
"errors"
|
|
|
|
_ "expvar" // to serve /debug/vars
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"go/ast"
|
|
|
|
"go/build"
|
|
|
|
"go/printer"
|
|
|
|
"io"
|
|
|
|
"log"
|
|
|
|
"net/http"
|
2013-07-17 01:25:54 -06:00
|
|
|
"net/http/httptest"
|
2013-07-16 22:02:35 -06:00
|
|
|
_ "net/http/pprof" // to serve /debug/pprof/*
|
|
|
|
"net/url"
|
|
|
|
"os"
|
|
|
|
pathpkg "path"
|
|
|
|
"path/filepath"
|
|
|
|
"regexp"
|
|
|
|
"runtime"
|
|
|
|
"strings"
|
2013-07-16 23:02:27 -06:00
|
|
|
|
2013-07-17 01:09:54 -06:00
|
|
|
"code.google.com/p/go.tools/godoc"
|
2013-07-16 23:02:27 -06:00
|
|
|
"code.google.com/p/go.tools/godoc/vfs"
|
|
|
|
"code.google.com/p/go.tools/godoc/vfs/zipfs"
|
2013-07-16 22:02:35 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
const defaultAddr = ":6060" // default webserver address
|
|
|
|
|
|
|
|
var (
|
|
|
|
// file system to serve
|
|
|
|
// (with e.g.: zip -r go.zip $GOROOT -i \*.go -i \*.html -i \*.css -i \*.js -i \*.txt -i \*.c -i \*.h -i \*.s -i \*.png -i \*.jpg -i \*.sh -i favicon.ico)
|
|
|
|
zipfile = flag.String("zip", "", "zip file providing the file system to serve; disabled if empty")
|
|
|
|
|
|
|
|
// file-based index
|
|
|
|
writeIndex = flag.Bool("write_index", false, "write index to a file; the file name must be specified with -index_files")
|
|
|
|
|
|
|
|
// network
|
|
|
|
httpAddr = flag.String("http", "", "HTTP service address (e.g., '"+defaultAddr+"')")
|
|
|
|
serverAddr = flag.String("server", "", "webserver address for command line searches")
|
|
|
|
|
|
|
|
// layout control
|
|
|
|
html = flag.Bool("html", false, "print HTML in command-line mode")
|
|
|
|
srcMode = flag.Bool("src", false, "print (exported) source in command-line mode")
|
|
|
|
urlFlag = flag.String("url", "", "print HTML for named URL")
|
|
|
|
|
|
|
|
// command-line searches
|
|
|
|
query = flag.Bool("q", false, "arguments are considered search queries")
|
|
|
|
)
|
|
|
|
|
|
|
|
func usage() {
|
|
|
|
fmt.Fprintf(os.Stderr,
|
|
|
|
"usage: godoc package [name ...]\n"+
|
|
|
|
" godoc -http="+defaultAddr+"\n")
|
|
|
|
flag.PrintDefaults()
|
|
|
|
os.Exit(2)
|
|
|
|
}
|
|
|
|
|
|
|
|
func loggingHandler(h http.Handler) http.Handler {
|
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
|
|
|
log.Printf("%s\t%s", req.RemoteAddr, req.URL)
|
|
|
|
h.ServeHTTP(w, req)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func remoteSearch(query string) (res *http.Response, err error) {
|
|
|
|
// list of addresses to try
|
|
|
|
var addrs []string
|
|
|
|
if *serverAddr != "" {
|
|
|
|
// explicit server address - only try this one
|
|
|
|
addrs = []string{*serverAddr}
|
|
|
|
} else {
|
|
|
|
addrs = []string{
|
|
|
|
defaultAddr,
|
|
|
|
"golang.org",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// remote search
|
|
|
|
search := remoteSearchURL(query, *html)
|
|
|
|
for _, addr := range addrs {
|
|
|
|
url := "http://" + addr + search
|
|
|
|
res, err = http.Get(url)
|
|
|
|
if err == nil && res.StatusCode == http.StatusOK {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if err == nil && res.StatusCode != http.StatusOK {
|
|
|
|
err = errors.New(res.Status)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Does s look like a regular expression?
|
|
|
|
func isRegexp(s string) bool {
|
|
|
|
return strings.IndexAny(s, ".(|)*+?^$[]") >= 0
|
|
|
|
}
|
|
|
|
|
|
|
|
// Make a regular expression of the form
|
|
|
|
// names[0]|names[1]|...names[len(names)-1].
|
|
|
|
// Returns nil if the regular expression is illegal.
|
|
|
|
func makeRx(names []string) (rx *regexp.Regexp) {
|
|
|
|
if len(names) > 0 {
|
|
|
|
s := ""
|
|
|
|
for i, name := range names {
|
|
|
|
if i > 0 {
|
|
|
|
s += "|"
|
|
|
|
}
|
|
|
|
if isRegexp(name) {
|
|
|
|
s += name
|
|
|
|
} else {
|
|
|
|
s += "^" + name + "$" // must match exactly
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rx, _ = regexp.Compile(s) // rx is nil if there's a compilation error
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
flag.Usage = usage
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
// Check usage: either server and no args, command line and args, or index creation mode
|
|
|
|
if (*httpAddr != "" || *urlFlag != "") != (flag.NArg() == 0) && !*writeIndex {
|
|
|
|
usage()
|
|
|
|
}
|
|
|
|
|
2013-07-17 17:52:45 -06:00
|
|
|
fs := vfs.NameSpace{}
|
|
|
|
godoc.FS = fs // temp hack
|
2013-07-16 22:02:35 -06:00
|
|
|
|
|
|
|
// Determine file system to use.
|
|
|
|
// TODO(gri) - fs and fsHttp should really be the same. Try to unify.
|
|
|
|
// - fsHttp doesn't need to be set up in command-line mode,
|
|
|
|
// same is true for the http handlers in initHandlers.
|
|
|
|
if *zipfile == "" {
|
|
|
|
// use file system of underlying OS
|
2013-07-17 17:52:45 -06:00
|
|
|
fs.Bind("/", vfs.OS(*goroot), "/", vfs.BindReplace)
|
2013-07-16 22:02:35 -06:00
|
|
|
if *templateDir != "" {
|
2013-07-17 17:52:45 -06:00
|
|
|
fs.Bind("/lib/godoc", vfs.OS(*templateDir), "/", vfs.BindBefore)
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// use file system specified via .zip file (path separator must be '/')
|
|
|
|
rc, err := zip.OpenReader(*zipfile)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("%s: %s\n", *zipfile, err)
|
|
|
|
}
|
|
|
|
defer rc.Close() // be nice (e.g., -writeIndex mode)
|
2013-07-17 17:52:45 -06:00
|
|
|
fs.Bind("/", zipvfs.New(rc, *zipfile), *goroot, vfs.BindReplace)
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Bind $GOPATH trees into Go root.
|
|
|
|
for _, p := range filepath.SplitList(build.Default.GOPATH) {
|
2013-07-17 17:52:45 -06:00
|
|
|
fs.Bind("/src/pkg", vfs.OS(p), "/src", vfs.BindAfter)
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
readTemplates()
|
2013-07-17 17:52:45 -06:00
|
|
|
|
|
|
|
corpus := godoc.NewCorpus(fs)
|
|
|
|
corpus.IndexEnabled = *indexEnabled
|
|
|
|
corpus.IndexFiles = *indexFiles
|
|
|
|
|
|
|
|
pres = godoc.NewPresentation(corpus)
|
|
|
|
// ...
|
|
|
|
godoc.InitHandlers(pres)
|
2013-07-16 22:02:35 -06:00
|
|
|
|
|
|
|
if *writeIndex {
|
|
|
|
// Write search index and exit.
|
2013-07-17 01:09:54 -06:00
|
|
|
if godoc.IndexFiles == "" {
|
2013-07-16 22:02:35 -06:00
|
|
|
log.Fatal("no index file specified")
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Println("initialize file systems")
|
|
|
|
*verbose = true // want to see what happens
|
|
|
|
|
2013-07-17 01:09:54 -06:00
|
|
|
godoc.IndexThrottle = 1.0
|
|
|
|
godoc.UpdateIndex()
|
2013-07-16 22:02:35 -06:00
|
|
|
|
2013-07-17 01:09:54 -06:00
|
|
|
log.Println("writing index file", godoc.IndexFiles)
|
|
|
|
f, err := os.Create(godoc.IndexFiles)
|
2013-07-16 22:02:35 -06:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2013-07-17 01:09:54 -06:00
|
|
|
index, _ := godoc.SearchIndex.Get()
|
|
|
|
err = index.(*godoc.Index).Write(f)
|
2013-07-16 22:02:35 -06:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Println("done")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Print content that would be served at the URL *urlFlag.
|
|
|
|
if *urlFlag != "" {
|
|
|
|
registerPublicHandlers(http.DefaultServeMux)
|
2013-07-17 17:52:45 -06:00
|
|
|
|
2013-07-16 22:02:35 -06:00
|
|
|
// Try up to 10 fetches, following redirects.
|
|
|
|
urlstr := *urlFlag
|
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
// Prepare request.
|
|
|
|
u, err := url.Parse(urlstr)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
req := &http.Request{
|
|
|
|
URL: u,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Invoke default HTTP handler to serve request
|
|
|
|
// to our buffering httpWriter.
|
2013-07-17 01:25:54 -06:00
|
|
|
w := httptest.NewRecorder()
|
2013-07-16 22:02:35 -06:00
|
|
|
http.DefaultServeMux.ServeHTTP(w, req)
|
|
|
|
|
|
|
|
// Return data, error, or follow redirect.
|
2013-07-17 01:25:54 -06:00
|
|
|
switch w.Code {
|
2013-07-16 22:02:35 -06:00
|
|
|
case 200: // ok
|
2013-07-17 01:25:54 -06:00
|
|
|
os.Stdout.Write(w.Body.Bytes())
|
2013-07-16 22:02:35 -06:00
|
|
|
return
|
|
|
|
case 301, 302, 303, 307: // redirect
|
2013-07-17 01:25:54 -06:00
|
|
|
redirect := w.HeaderMap.Get("Location")
|
2013-07-16 22:02:35 -06:00
|
|
|
if redirect == "" {
|
2013-07-17 01:25:54 -06:00
|
|
|
log.Fatalf("HTTP %d without Location header", w.Code)
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
urlstr = redirect
|
|
|
|
default:
|
2013-07-17 01:25:54 -06:00
|
|
|
log.Fatalf("HTTP error %d", w.Code)
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
log.Fatalf("too many redirects")
|
|
|
|
}
|
|
|
|
|
|
|
|
if *httpAddr != "" {
|
|
|
|
// HTTP server mode.
|
|
|
|
var handler http.Handler = http.DefaultServeMux
|
|
|
|
if *verbose {
|
|
|
|
log.Printf("Go Documentation Server")
|
|
|
|
log.Printf("version = %s", runtime.Version())
|
|
|
|
log.Printf("address = %s", *httpAddr)
|
|
|
|
log.Printf("goroot = %s", *goroot)
|
2013-07-17 01:09:54 -06:00
|
|
|
log.Printf("tabwidth = %d", godoc.TabWidth)
|
2013-07-16 22:02:35 -06:00
|
|
|
switch {
|
2013-07-17 17:52:45 -06:00
|
|
|
case !*indexEnabled:
|
2013-07-16 22:02:35 -06:00
|
|
|
log.Print("search index disabled")
|
2013-07-17 01:09:54 -06:00
|
|
|
case godoc.MaxResults > 0:
|
|
|
|
log.Printf("full text index enabled (maxresults = %d)", godoc.MaxResults)
|
2013-07-16 22:02:35 -06:00
|
|
|
default:
|
|
|
|
log.Print("identifier search index enabled")
|
|
|
|
}
|
2013-07-17 17:52:45 -06:00
|
|
|
fs.Fprint(os.Stderr)
|
2013-07-16 22:02:35 -06:00
|
|
|
handler = loggingHandler(handler)
|
|
|
|
}
|
|
|
|
|
|
|
|
registerPublicHandlers(http.DefaultServeMux)
|
|
|
|
|
|
|
|
// Initialize search index.
|
2013-07-17 17:52:45 -06:00
|
|
|
if *indexEnabled {
|
2013-07-17 01:09:54 -06:00
|
|
|
go godoc.RunIndexer()
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Start http server.
|
|
|
|
if err := http.ListenAndServe(*httpAddr, handler); err != nil {
|
|
|
|
log.Fatalf("ListenAndServe %s: %v", *httpAddr, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2013-07-17 01:09:54 -06:00
|
|
|
packageText := godoc.PackageText
|
|
|
|
|
2013-07-16 22:02:35 -06:00
|
|
|
// Command line mode.
|
|
|
|
if *html {
|
2013-07-17 01:09:54 -06:00
|
|
|
packageText = godoc.PackageHTML
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if *query {
|
|
|
|
// Command-line queries.
|
|
|
|
for i := 0; i < flag.NArg(); i++ {
|
|
|
|
res, err := remoteSearch(flag.Arg(i))
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("remoteSearch: %s", err)
|
|
|
|
}
|
|
|
|
io.Copy(os.Stdout, res.Body)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Determine paths.
|
|
|
|
//
|
|
|
|
// If we are passed an operating system path like . or ./foo or /foo/bar or c:\mysrc,
|
|
|
|
// we need to map that path somewhere in the fs name space so that routines
|
|
|
|
// like getPageInfo will see it. We use the arbitrarily-chosen virtual path "/target"
|
|
|
|
// for this. That is, if we get passed a directory like the above, we map that
|
|
|
|
// directory so that getPageInfo sees it as /target.
|
|
|
|
const target = "/target"
|
|
|
|
const cmdPrefix = "cmd/"
|
|
|
|
path := flag.Arg(0)
|
|
|
|
var forceCmd bool
|
|
|
|
var abspath, relpath string
|
|
|
|
if filepath.IsAbs(path) {
|
2013-07-17 17:52:45 -06:00
|
|
|
fs.Bind(target, vfs.OS(path), "/", vfs.BindReplace)
|
2013-07-16 22:02:35 -06:00
|
|
|
abspath = target
|
|
|
|
} else if build.IsLocalImport(path) {
|
|
|
|
cwd, _ := os.Getwd() // ignore errors
|
|
|
|
path = filepath.Join(cwd, path)
|
2013-07-17 17:52:45 -06:00
|
|
|
fs.Bind(target, vfs.OS(path), "/", vfs.BindReplace)
|
2013-07-16 22:02:35 -06:00
|
|
|
abspath = target
|
|
|
|
} else if strings.HasPrefix(path, cmdPrefix) {
|
|
|
|
path = strings.TrimPrefix(path, cmdPrefix)
|
|
|
|
forceCmd = true
|
|
|
|
} else if bp, _ := build.Import(path, "", build.FindOnly); bp.Dir != "" && bp.ImportPath != "" {
|
2013-07-17 17:52:45 -06:00
|
|
|
fs.Bind(target, vfs.OS(bp.Dir), "/", vfs.BindReplace)
|
2013-07-16 22:02:35 -06:00
|
|
|
abspath = target
|
|
|
|
relpath = bp.ImportPath
|
|
|
|
} else {
|
2013-07-17 01:09:54 -06:00
|
|
|
abspath = pathpkg.Join(godoc.PkgHandler.FSRoot(), path)
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
if relpath == "" {
|
|
|
|
relpath = abspath
|
|
|
|
}
|
|
|
|
|
2013-07-17 01:09:54 -06:00
|
|
|
var mode godoc.PageInfoMode
|
|
|
|
if relpath == godoc.BuiltinPkgPath {
|
2013-07-16 22:02:35 -06:00
|
|
|
// the fake built-in package contains unexported identifiers
|
2013-07-17 01:09:54 -06:00
|
|
|
mode = godoc.NoFiltering
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
if *srcMode {
|
|
|
|
// only filter exports if we don't have explicit command-line filter arguments
|
|
|
|
if flag.NArg() > 1 {
|
2013-07-17 01:09:54 -06:00
|
|
|
mode |= godoc.NoFiltering
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
2013-07-17 01:09:54 -06:00
|
|
|
mode |= godoc.ShowSource
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// first, try as package unless forced as command
|
2013-07-17 01:09:54 -06:00
|
|
|
var info *godoc.PageInfo
|
2013-07-16 22:02:35 -06:00
|
|
|
if !forceCmd {
|
2013-07-17 01:09:54 -06:00
|
|
|
info = godoc.PkgHandler.GetPageInfo(abspath, relpath, mode)
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// second, try as command unless the path is absolute
|
|
|
|
// (the go command invokes godoc w/ absolute paths; don't override)
|
2013-07-17 01:09:54 -06:00
|
|
|
var cinfo *godoc.PageInfo
|
2013-07-16 22:02:35 -06:00
|
|
|
if !filepath.IsAbs(path) {
|
2013-07-17 01:09:54 -06:00
|
|
|
abspath = pathpkg.Join(godoc.CmdHandler.FSRoot(), path)
|
|
|
|
cinfo = godoc.CmdHandler.GetPageInfo(abspath, relpath, mode)
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// determine what to use
|
|
|
|
if info == nil || info.IsEmpty() {
|
|
|
|
if cinfo != nil && !cinfo.IsEmpty() {
|
|
|
|
// only cinfo exists - switch to cinfo
|
|
|
|
info = cinfo
|
|
|
|
}
|
|
|
|
} else if cinfo != nil && !cinfo.IsEmpty() {
|
|
|
|
// both info and cinfo exist - use cinfo if info
|
|
|
|
// contains only subdirectory information
|
|
|
|
if info.PAst == nil && info.PDoc == nil {
|
|
|
|
info = cinfo
|
|
|
|
} else {
|
|
|
|
fmt.Printf("use 'godoc %s%s' for documentation on the %s command \n\n", cmdPrefix, relpath, relpath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if info == nil {
|
|
|
|
log.Fatalf("%s: no such directory or package", flag.Arg(0))
|
|
|
|
}
|
|
|
|
if info.Err != nil {
|
|
|
|
log.Fatalf("%v", info.Err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if info.PDoc != nil && info.PDoc.ImportPath == target {
|
|
|
|
// Replace virtual /target with actual argument from command line.
|
|
|
|
info.PDoc.ImportPath = flag.Arg(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we have more than one argument, use the remaining arguments for filtering.
|
|
|
|
if flag.NArg() > 1 {
|
|
|
|
args := flag.Args()[1:]
|
|
|
|
rx := makeRx(args)
|
|
|
|
if rx == nil {
|
|
|
|
log.Fatalf("illegal regular expression from %v", args)
|
|
|
|
}
|
|
|
|
|
|
|
|
filter := func(s string) bool { return rx.MatchString(s) }
|
|
|
|
switch {
|
|
|
|
case info.PAst != nil:
|
|
|
|
cmap := ast.NewCommentMap(info.FSet, info.PAst, info.PAst.Comments)
|
|
|
|
ast.FilterFile(info.PAst, filter)
|
|
|
|
// Special case: Don't use templates for printing
|
|
|
|
// so we only get the filtered declarations without
|
|
|
|
// package clause or extra whitespace.
|
|
|
|
for i, d := range info.PAst.Decls {
|
|
|
|
// determine the comments associated with d only
|
|
|
|
comments := cmap.Filter(d).Comments()
|
|
|
|
cn := &printer.CommentedNode{Node: d, Comments: comments}
|
|
|
|
if i > 0 {
|
|
|
|
fmt.Println()
|
|
|
|
}
|
|
|
|
if *html {
|
|
|
|
var buf bytes.Buffer
|
2013-07-17 01:09:54 -06:00
|
|
|
godoc.WriteNode(&buf, info.FSet, cn)
|
|
|
|
godoc.FormatText(os.Stdout, buf.Bytes(), -1, true, "", nil)
|
2013-07-16 22:02:35 -06:00
|
|
|
} else {
|
2013-07-17 01:09:54 -06:00
|
|
|
godoc.WriteNode(os.Stdout, info.FSet, cn)
|
2013-07-16 22:02:35 -06:00
|
|
|
}
|
|
|
|
fmt.Println()
|
|
|
|
}
|
|
|
|
return
|
|
|
|
|
|
|
|
case info.PDoc != nil:
|
|
|
|
info.PDoc.Filter(filter)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := packageText.Execute(os.Stdout, info); err != nil {
|
|
|
|
log.Printf("packageText.Execute: %s", err)
|
|
|
|
}
|
|
|
|
}
|