diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-01-30 15:38:19 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-01-30 15:38:19 +0100 |
commit | 4cecda6c347bd6902b960c6a35a967add7070b0d (patch) | |
tree | a462e224ff41ec9f3eb1a0b6e815806f9e8804ad /src/cmd/godoc/appinit.go | |
parent | 6c7ca6e4d4e26e4c8cbe0d183966011b3b088a0a (diff) | |
download | golang-4cecda6c347bd6902b960c6a35a967add7070b0d.tar.gz |
Imported Upstream version 2012.01.27upstream-weekly/2012.01.27
Diffstat (limited to 'src/cmd/godoc/appinit.go')
-rw-r--r-- | src/cmd/godoc/appinit.go | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/src/cmd/godoc/appinit.go b/src/cmd/godoc/appinit.go index 8c93425f3..3113498c8 100644 --- a/src/cmd/godoc/appinit.go +++ b/src/cmd/godoc/appinit.go @@ -2,52 +2,21 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// To run godoc under app engine, substitute main.go with -// this file (appinit.go), provide a .zip file containing -// the file system to serve, the index file (or files) -// containing the pre-computed search index and adjust -// the configuration parameters in appconfig.go accordingly. -// -// The current app engine SDK may be based on an older Go -// release version. To correct for version skew, copy newer -// packages into the alt directory (e.g. alt/strings) and -// adjust the imports in the godoc source files (e.g. from -// `import "strings"` to `import "alt/strings"`). Both old -// and new packages may be used simultaneously as long as -// there is no package global state that needs to be shared. -// -// The directory structure should look as follows: -// -// godoc-app // directory containing the app engine app -// alt // alternative packages directory to -// // correct for version skew -// strings // never version of the strings package -// ... // -// app.yaml // app engine control file -// godoc.zip // .zip file containing the file system to serve -// godoc // contains godoc sources -// appinit.go // this file instead of godoc/main.go -// appconfig.go // godoc for app engine configuration -// ... // -// index.split.* // index file(s) containing the search index to serve -// -// To run app the engine emulator locally: -// -// dev_appserver.py -a 0 godoc-app -// -// The godoc home page is served at: <hostname>:8080 and localhost:8080. +// +build ignore package main +// This file replaces main.go when running godoc under app-engine. +// See README.godoc-app for details. + import ( "archive/zip" - "http" "log" - "os" + "net/http" "path" ) -func serveError(w http.ResponseWriter, r *http.Request, relpath string, err os.Error) { +func serveError(w http.ResponseWriter, r *http.Request, relpath string, err error) { contents := applyTemplate(errorHTML, "errorHTML", err) // err may contain an absolute path! w.WriteHeader(http.StatusNotFound) servePage(w, "File "+relpath, "", "", contents) |