go/godoc-path-locations.patch

41 lines
1.0 KiB
Diff
Raw Normal View History

diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
index f6dc678..0fa85bc 100644
--- a/src/cmd/godoc/godoc.go
+++ b/src/cmd/godoc/godoc.go
@@ -82,7 +82,35 @@ var (
pkgHandler docServer
)
+const (
+ SUSE_DOC_DIR = "/usr/share/doc/packages/go-doc/"
+ SUSE_SRC_DIR = "/usr/share/go"
+ SUSE_CONTRIB_SRC_DIR = "/usr/share/go/contrib/src/pkg/"
+)
+
func initHandlers() {
+ // OPENSUSE: Bind godoc & source location
+ fs.Bind("/doc", OS(SUSE_DOC_DIR), "/doc", bindReplace)
+ fs.Bind("/src", OS(SUSE_SRC_DIR), "/src", bindBefore)
+
+ d, err := os.Open(SUSE_CONTRIB_SRC_DIR)
+ if err != nil {
+ log.Fatalf("cannot read Go contrib source dir:", err)
+ }
+ if files, err := d.Readdir(0); err == nil {
+ for _, file := range files {
+ if file.IsDir() {
+ path := SUSE_CONTRIB_SRC_DIR + file.Name()
+ if *pkgPath != "" {
+ *pkgPath += ":"
+ }
+ *pkgPath += path
+ }
+ }
+ } else {
+ log.Fatal(err)
+ }
+
// Add named directories in -path argument as
// subdirectories of src/pkg.
for _, p := range filepath.SplitList(*pkgPath) {