2012-03-06 05:25:38 +01:00
|
|
|
diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
|
2012-05-09 17:04:39 +02:00
|
|
|
index f6dc678..0fa85bc 100644
|
2012-03-06 05:25:38 +01:00
|
|
|
--- a/src/cmd/godoc/godoc.go
|
|
|
|
+++ b/src/cmd/godoc/godoc.go
|
2012-05-09 17:04:39 +02:00
|
|
|
@@ -82,7 +82,35 @@ var (
|
2012-03-06 05:25:38 +01:00
|
|
|
pkgHandler docServer
|
|
|
|
)
|
2012-05-09 17:04:39 +02:00
|
|
|
|
2012-03-06 05:25:38 +01:00
|
|
|
+const (
|
|
|
|
+ SUSE_DOC_DIR = "/usr/share/doc/packages/go-doc/"
|
2012-05-09 17:04:39 +02:00
|
|
|
+ SUSE_SRC_DIR = "/usr/share/go"
|
|
|
|
+ SUSE_CONTRIB_SRC_DIR = "/usr/share/go/contrib/src/pkg/"
|
2012-03-06 05:25:38 +01:00
|
|
|
+)
|
2012-05-09 17:04:39 +02:00
|
|
|
+
|
2012-03-06 05:25:38 +01:00
|
|
|
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)
|
2012-05-09 17:04:39 +02:00
|
|
|
+
|
|
|
|
+ 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)
|
|
|
|
+ }
|
2012-03-06 05:25:38 +01:00
|
|
|
+
|
|
|
|
// Add named directories in -path argument as
|
|
|
|
// subdirectories of src/pkg.
|
|
|
|
for _, p := range filepath.SplitList(*pkgPath) {
|