diff --git a/cmd/godoc/godoc_test.go b/cmd/godoc/godoc_test.go index 483b8643..97b00d0c 100644 --- a/cmd/godoc/godoc_test.go +++ b/cmd/godoc/godoc_test.go @@ -44,9 +44,7 @@ var godocTests = []struct { { args: []string{"nonexistingpkg"}, matches: []string{ - // The last pattern (does not e) is for plan9: - // http://build.golang.org/log/2d8e5e14ed365bfa434b37ec0338cd9e6f8dd9bf - `no such file or directory|does not exist|cannot find the file|(?:' does not e)`, + `cannot find package`, }, }, { diff --git a/godoc/server.go b/godoc/server.go index 104e75b6..162e5a6a 100644 --- a/godoc/server.go +++ b/godoc/server.go @@ -65,6 +65,10 @@ func (h *handlerServer) GetPageInfo(abspath, relpath string, mode PageInfoMode, // are used. ctxt := build.Default ctxt.IsAbsPath = pathpkg.IsAbs + ctxt.IsDir = func(path string) bool { + fi, err := h.c.fs.Stat(filepath.ToSlash(path)) + return err == nil && fi.IsDir() + } ctxt.ReadDir = func(dir string) ([]os.FileInfo, error) { f, err := h.c.fs.ReadDir(filepath.ToSlash(dir)) filtered := make([]os.FileInfo, 0, len(f))