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
// though the directory doesn't contain any real package files - was bug)
if synopses[0] == "" {
// 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)
if err == nil {
hasPkgFiles = true
......
......@@ -17,18 +17,18 @@ import (
"path/filepath"
)
func parseFile(fset *token.FileSet, filename string, mode uint) (*ast.File, os.Error) {
src, err := fs.ReadFile(filename)
if err != nil {
return nil, err
}
return parser.ParseFile(fset, filename, src, mode)
}
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 {
src, err := fs.ReadFile(filename)
if err != nil {
if first == nil {
first = err
}
continue
}
file, err := parser.ParseFile(fset, filename, src, parser.ParseComments)
file, err := parseFile(fset, filename, parser.ParseComments)
if err != nil {
if first == nil {
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