go/go-godoc-path-locations.patch
Sascha Peilicke 986f6e5838 - Update to release r59:
* Restricted usage of goto statement
  * Package reflect supports a new struct tag scheme that enables sharing of
    struct tags between multiple packages.
  * Package sort's IntArray type has been renamed to IntSlice, and similarly
    for Float64Slice and StringSlice
  * Package strings's Split function has itself been split into Split and
    SplitN. SplitN is the same as the old Split. The new Split is equivalent
    to SplitN with a final argument of -1. 
  * Goinstall now installs packages and commands from arbitrary remote
    repositories (not just Google Code, Github, and so on). See the goinstall
    documentation for details. 
  More at http://golang.org/doc/devel/release.html#r59
- Update to 2011-07-20 mercurial version:
- Update to weekly.2011-07-19 mercurial version:

OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=82
2011-08-02 08:19:31 +00:00

59 lines
1.9 KiB
Diff

diff -ru a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
--- a/src/cmd/godoc/godoc.go 2011-08-02 09:44:36.104812881 +0200
+++ b/src/cmd/godoc/godoc.go 2011-08-02 09:54:43.389050505 +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":
Only in b/src/cmd/godoc: .godoc.go.swp