Commit 52818f45 authored by Robert Griesemer's avatar Robert Griesemer

godoc: use virtual file system when generating package synopses

Fix for godoc on app engine.

R=dsymonds
CC=golang-dev
https://golang.org/cl/4922050
parent 940281bd
...@@ -117,7 +117,7 @@ func (b *treeBuilder) newDirTree(fset *token.FileSet, path, name string, depth i ...@@ -117,7 +117,7 @@ func (b *treeBuilder) newDirTree(fset *token.FileSet, path, name string, depth i
// though the directory doesn't contain any real package files - was bug) // though the directory doesn't contain any real package files - was bug)
if synopses[0] == "" { if synopses[0] == "" {
// no "optimal" package synopsis yet; continue to collect synopses // no "optimal" package synopsis yet; continue to collect synopses
file, err := parser.ParseFile(fset, filepath.Join(path, d.Name()), nil, file, err := parseFile(fset, filepath.Join(path, d.Name()),
parser.ParseComments|parser.PackageClauseOnly) parser.ParseComments|parser.PackageClauseOnly)
if err == nil { if err == nil {
hasPkgFiles = true hasPkgFiles = true
......
...@@ -17,18 +17,18 @@ import ( ...@@ -17,18 +17,18 @@ import (
"path/filepath" "path/filepath"
) )
func parseFiles(fset *token.FileSet, filenames []string) (pkgs map[string]*ast.Package, first os.Error) { func parseFile(fset *token.FileSet, filename string, mode uint) (*ast.File, os.Error) {
pkgs = make(map[string]*ast.Package)
for _, filename := range filenames {
src, err := fs.ReadFile(filename) src, err := fs.ReadFile(filename)
if err != nil { if err != nil {
if first == nil { return nil, err
first = err
}
continue
} }
return parser.ParseFile(fset, filename, src, mode)
}
file, err := parser.ParseFile(fset, filename, src, parser.ParseComments) func parseFiles(fset *token.FileSet, filenames []string) (pkgs map[string]*ast.Package, first os.Error) {
pkgs = make(map[string]*ast.Package)
for _, filename := range filenames {
file, err := parseFile(fset, filename, parser.ParseComments)
if err != nil { if err != nil {
if first == nil { if first == nil {
first = err first = err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment