go/go-godoc-path-locations.patch

59 lines
1.9 KiB
Diff
Raw Normal View History

diff -ru a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
--- a/src/cmd/godoc/godoc.go 2011-09-22 10:15:24.000000000 +0200
+++ b/src/cmd/godoc/godoc.go 2011-09-22 10:25:35.697267470 +0200
@@ -80,6 +80,11 @@
pkgHandler httpHandler
)
+const (
+ docroot = "/usr/share/doc/packages/go-doc/doc"
+ srcroot = "/usr/share/go/"
+)
+
func initHandlers() {
paths := filepath.SplitList(*pkgPath)
for _, t := range build.Path {
@@ -90,9 +95,9 @@
}
fsMap.Init(paths)
- fileServer = http.FileServer(fsHttp)
- 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}
}
func registerPublicHandlers(mux *http.ServeMux) {
@@ -531,7 +536,7 @@
}
func readTemplate(name string) *template.Template {
- path := filepath.Join(*goroot, "lib", "godoc", name)
- Update to weekly.2011-07-19 mercurial version * archive/zip: add Writer, add Mtime_ns function to get modified time in sensible format. * cgi: close stdout reader pipe when finished. * cgo: add missing semicolon in generated struct, * codereview: fix for Mercurial 1.9. * dashboard: list "most installed this week" with rolling count. * debug/elf: read ELF Program headers. * debug/proc: remove unused package. * doc/talks/io2010: update with gofix and handle the errors. * exp/eval, exp/ogle: remove packages eval and ogle. * exp/regexp/syntax: add Prog.NumCap. * exp/template: API changes, bug fixes, and tweaks. * flag: make -help nicer. * fmt: Scan(&int) was mishandling a lone digit. * gc: fix closure bug, fix to build with clang, make size of struct{} and [0]byte 0 bytes , some enhancements to printing debug info. * gif: fix local color map and coordinates. * go/build: include processing of .c files for cgo packages, less aggressive failure when GOROOT not found. * go/printer: changed max. number of newlines from 3 to 2. * gob: register more slice types * godoc: support for file systems stored in .zip files. * hash/crc32: add SSE4.2 support. * html: update section references in comments to the latest HTML5 spec. * http: drain the pipe output in TestHandlerPanic to avoid logging deadlock, fix Content-Type of file extension, implement http.FileSystem for zip files, let FileServer work when path doesn't begin with a slash, support for periodic flushing in ReverseProxy. * image/draw: add benchmarks. OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=80
2011-07-20 10:23:17 +02:00
+ path := filepath.Join(*goroot, "lib/"+name)
if *templateDir != "" {
defaultpath := path
path = filepath.Join(*templateDir, name)
@@ -702,13 +707,18 @@
}
func serveFile(w http.ResponseWriter, r *http.Request) {
- Update to weekly.2011-07-19 mercurial version * archive/zip: add Writer, add Mtime_ns function to get modified time in sensible format. * cgi: close stdout reader pipe when finished. * cgo: add missing semicolon in generated struct, * codereview: fix for Mercurial 1.9. * dashboard: list "most installed this week" with rolling count. * debug/elf: read ELF Program headers. * debug/proc: remove unused package. * doc/talks/io2010: update with gofix and handle the errors. * exp/eval, exp/ogle: remove packages eval and ogle. * exp/regexp/syntax: add Prog.NumCap. * exp/template: API changes, bug fixes, and tweaks. * flag: make -help nicer. * fmt: Scan(&int) was mishandling a lone digit. * gc: fix closure bug, fix to build with clang, make size of struct{} and [0]byte 0 bytes , some enhancements to printing debug info. * gif: fix local color map and coordinates. * go/build: include processing of .c files for cgo packages, less aggressive failure when GOROOT not found. * go/printer: changed max. number of newlines from 3 to 2. * gob: register more slice types * godoc: support for file systems stored in .zip files. * hash/crc32: add SSE4.2 support. * html: update section references in comments to the latest HTML5 spec. * http: drain the pipe output in TestHandlerPanic to avoid logging deadlock, fix Content-Type of file extension, implement http.FileSystem for zip files, let FileServer work when path doesn't begin with a slash, support for periodic flushing in ReverseProxy. * image/draw: add benchmarks. OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=80
2011-07-20 10:23:17 +02:00
+ // 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"), "root.html")
return
case "/doc/root.html":