2012-01-25 04:57:43 +01:00
|
|
|
diff --git a/src/cmd/godoc/godoc.go b/src/cmd/godoc/godoc.go
|
|
|
|
--- a/src/cmd/godoc/godoc.go
|
|
|
|
+++ b/src/cmd/godoc/godoc.go
|
|
|
|
@@ -88,6 +88,12 @@
|
2011-05-18 13:09:25 +02:00
|
|
|
pkgHandler httpHandler
|
|
|
|
)
|
2012-01-28 17:28:41 +01:00
|
|
|
|
2012-01-25 04:57:43 +01:00
|
|
|
+// OPENSUSE-PATCHFIX-GODOC-LOCATIONS
|
2011-07-10 17:54:26 +02:00
|
|
|
+const (
|
2011-08-02 10:19:31 +02:00
|
|
|
+ docroot = "/usr/share/doc/packages/go-doc/doc"
|
|
|
|
+ srcroot = "/usr/share/go/"
|
2011-07-10 17:54:26 +02:00
|
|
|
+)
|
2011-09-27 09:53:31 +02:00
|
|
|
+
|
2011-05-18 13:09:25 +02:00
|
|
|
func initHandlers() {
|
2011-07-10 17:54:26 +02:00
|
|
|
paths := filepath.SplitList(*pkgPath)
|
2011-09-27 09:53:31 +02:00
|
|
|
for _, t := range build.Path {
|
2012-01-25 04:57:43 +01:00
|
|
|
@@ -98,9 +104,9 @@
|
2011-07-10 17:54:26 +02:00
|
|
|
}
|
|
|
|
fsMap.Init(paths)
|
2012-01-28 17:28:41 +01:00
|
|
|
|
2011-09-27 09:53:31 +02:00
|
|
|
- fileServer = http.FileServer(fsHttp)
|
2011-05-18 13:09:25 +02:00
|
|
|
- cmdHandler = httpHandler{"/cmd/", filepath.Join(*goroot, "src", "cmd"), false}
|
|
|
|
- pkgHandler = httpHandler{"/pkg/", filepath.Join(*goroot, "src", "pkg"), true}
|
2011-07-10 17:54:26 +02:00
|
|
|
+ fileServer = http.FileServer(http.Dir(docroot))
|
2011-05-18 13:09:25 +02:00
|
|
|
+ cmdHandler = httpHandler{"/cmd/", filepath.Join(srcroot, "src/cmd"), false}
|
|
|
|
+ pkgHandler = httpHandler{"/pkg/", filepath.Join(srcroot, "src/pkg"), true}
|
|
|
|
}
|
2012-01-28 17:28:41 +01:00
|
|
|
|
2011-09-27 09:53:31 +02:00
|
|
|
func registerPublicHandlers(mux *http.ServeMux) {
|
2012-01-25 04:57:43 +01:00
|
|
|
@@ -603,7 +609,7 @@
|
2011-09-27 09:53:31 +02:00
|
|
|
}
|
2012-01-28 17:28:41 +01:00
|
|
|
|
2011-05-18 13:09:25 +02:00
|
|
|
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)
|
2011-07-10 17:54:26 +02:00
|
|
|
if *templateDir != "" {
|
|
|
|
defaultpath := path
|
|
|
|
path = filepath.Join(*templateDir, name)
|
2012-01-25 04:57:43 +01:00
|
|
|
@@ -780,6 +786,16 @@
|
2011-09-27 09:53:31 +02:00
|
|
|
}
|
2012-01-28 17:28:41 +01:00
|
|
|
|
2011-05-18 13:09:25 +02:00
|
|
|
func serveFile(w http.ResponseWriter, r *http.Request) {
|
2012-01-28 17:28:41 +01:00
|
|
|
+ // openSUSE: serv docs from root of go-doc package install location
|
- 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
|
|
|
+ if strings.HasPrefix(r.URL.Path, "/doc/") {
|
|
|
|
+ http.Redirect(w, r, "/"+ r.URL.Path[len("/doc"):], http.StatusMovedPermanently)
|
|
|
|
+ return
|
|
|
|
+ }
|
2012-01-25 04:57:43 +01:00
|
|
|
+ if r.URL.Path == "/" {
|
|
|
|
+ serveHTMLDoc(w, r, filepath.Join(docroot, "root.html"), "root.html")
|
|
|
|
+ return
|
|
|
|
+ }
|
2012-01-28 17:28:41 +01:00
|
|
|
+
|
2012-01-25 04:57:43 +01:00
|
|
|
relpath := r.URL.Path
|
2012-01-28 17:28:41 +01:00
|
|
|
|
2012-01-25 04:57:43 +01:00
|
|
|
// Check to see if we need to redirect or serve another file.
|
|
|
|
@@ -794,7 +810,7 @@
|
|
|
|
}
|
2012-01-28 17:28:41 +01:00
|
|
|
|
2012-01-25 04:57:43 +01:00
|
|
|
relpath = relpath[1:] // strip leading slash
|
2011-05-18 13:09:25 +02:00
|
|
|
- abspath := absolutePath(relpath, *goroot)
|
|
|
|
+ abspath := absolutePath(relpath, docroot)
|
2012-01-28 17:28:41 +01:00
|
|
|
|
2012-01-25 04:57:43 +01:00
|
|
|
switch path.Ext(relpath) {
|
|
|
|
case ".html":
|
|
|
|
@@ -1368,7 +1384,7 @@
|
|
|
|
metadata[meta.filePath] = &meta
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- scan(filepath.Join(*goroot, "doc"))
|
|
|
|
+ scan(filepath.Join(docroot, ""))
|
|
|
|
docMetadata.set(metadata)
|
|
|
|
}
|
2012-01-28 17:28:41 +01:00
|
|
|
|