Index: src/cmd/godoc/main.go |
=================================================================== |
--- a/src/cmd/godoc/main.go |
+++ b/src/cmd/godoc/main.go |
@@ -31,6 +31,7 @@ |
"flag" |
"fmt" |
"go/ast" |
+ "go/build" |
"http" |
_ "http/pprof" // to serve /debug/pprof/* |
"io" |
@@ -332,7 +333,10 @@ |
} |
relpath := path |
abspath := path |
- if !filepath.IsAbs(path) { |
+ if t, pkg, err := build.FindTree(path); err == nil { |
+ relpath = pkg |
+ abspath = filepath.Join(t.SrcDir(), pkg) |
+ } else if !filepath.IsAbs(path) { |
abspath = absolutePath(path, pkgHandler.fsRoot) |
} else { |
relpath = relativeURL(path) |