2bfa629adb
weekly.2011-07-07): * Package exec has been redesigned with a more convenient and succinct API. * Package os/signal's Signal and UnixSignal types have been moved to the os package. * Package image/draw is the new name for exp/draw. The GUI-related code from exp/draw is now located in the exp/gui package. More at http://golang.org/doc/devel/release.html#r58 OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=79
58 lines
1.9 KiB
Diff
58 lines
1.9 KiB
Diff
diff -u a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
|
|
--- a/src/cmd/godoc/godoc.go 2011-07-10 15:41:31.346160562 +0200
|
|
+++ b/src/cmd/godoc/godoc.go 2011-07-10 16:08:22.579780989 +0200
|
|
@@ -82,6 +82,10 @@
|
|
pkgHandler httpHandler
|
|
)
|
|
|
|
+const (
|
|
+ docroot = "/usr/share/doc/packages/go-doc/doc"
|
|
+ srcroot = "/usr/share/go/"
|
|
+)
|
|
|
|
func initHandlers() {
|
|
paths := filepath.SplitList(*pkgPath)
|
|
@@ -93,9 +97,9 @@
|
|
}
|
|
fsMap.Init(paths)
|
|
|
|
- fileServer = http.FileServer(http.Dir(*goroot))
|
|
- cmdHandler = httpHandler{"/cmd/", filepath.Join(*goroot, "src", "cmd"), false}
|
|
- pkgHandler = httpHandler{"/pkg/", filepath.Join(*goroot, "src", "pkg"), true}
|
|
+ fileServer = http.FileServer(http.Dir(docroot))
|
|
+ cmdHandler = httpHandler{"/cmd/", filepath.Join(srcroot, "src/cmd"), false}
|
|
+ pkgHandler = httpHandler{"/pkg/", filepath.Join(srcroot, "src/pkg"), true}
|
|
}
|
|
|
|
|
|
@@ -646,7 +650,7 @@
|
|
|
|
|
|
func readTemplate(name string) *template.Template {
|
|
- path := filepath.Join(*goroot, "lib", "godoc", name)
|
|
+ path := filepath.Join(*goroot, "lib/"+name)
|
|
if *templateDir != "" {
|
|
defaultpath := path
|
|
path = filepath.Join(*templateDir, name)
|
|
@@ -835,13 +839,18 @@
|
|
|
|
|
|
func serveFile(w http.ResponseWriter, r *http.Request) {
|
|
+ // openSUSE: serv docs from root of go-doc package install location
|
|
+ if strings.HasPrefix(r.URL.Path, "/doc/") {
|
|
+ http.Redirect(w, r, "/"+ r.URL.Path[len("/doc"):], http.StatusMovedPermanently)
|
|
+ return
|
|
+ }
|
|
relpath := r.URL.Path[1:] // serveFile URL paths start with '/'
|
|
- abspath := absolutePath(relpath, *goroot)
|
|
+ abspath := absolutePath(relpath, docroot)
|
|
|
|
// pick off special cases and hand the rest to the standard file server
|
|
switch r.URL.Path {
|
|
case "/":
|
|
- serveHTMLDoc(w, r, filepath.Join(*goroot, "doc", "root.html"), "doc/root.html")
|
|
+ serveHTMLDoc(w, r, filepath.Join(docroot, "doc", "root.html"), "doc/root.html")
|
|
return
|
|
|
|
case "/doc/root.html":
|