mirror of
https://github.com/golang/go
synced 2024-11-05 15:46:11 -07:00
d11f6ec946
Currently, links inside blog articles are absolute links to golang.org. But when a godoc server is run locally, the blog package should serve local links pointing to the local godoc server. It is not possible to simply change the links inside the blog templates to relative urls because the blog articles are independant pages on their own. And moreover, they are served from blog.golang.org. Rather, the blog package consumes and serves blog articles. So, a flag was added in the Config struct to denote whether to convert the links or not. This flag is then set from the call site in godoc package where the blog server is initialized from. This was required because "golang.org/x/tools/blog" is a package which can be used by other code to serve blog pages and not just godoc. This preserves existing functionality for all working code which imports "golang.org/x/tools/blog" and changes the functionality only when a godoc server is run locally. And while here, replace relevant bytes.Buffer occurences with strings.Builder. Fixes golang/go#22681 Change-Id: I7dbf9c5f2f93fd0b7e17915238de1c084fcd1431 Reviewed-on: https://go-review.googlesource.com/105835 Reviewed-by: Andrew Bonventre <andybons@golang.org> Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> |
||
---|---|---|
.. | ||
appinit.go | ||
autocert.go | ||
blog.go | ||
codewalk.go | ||
dl.go | ||
doc.go | ||
godoc19_test.go | ||
godoc_test.go | ||
handlers.go | ||
index.go | ||
main.go | ||
play.go | ||
README.godoc-app | ||
remotesearch.go | ||
setup-godoc-app.bash | ||
x.go |
godoc on appengine ------------------ Prerequisites ------------- * Go appengine SDK https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Go * Go sources at tip under $GOROOT * Godoc sources at tip inside $GOPATH (go get -d golang.org/x/tools/cmd/godoc) Directory structure ------------------- * Let $APPDIR be the directory containing the app engine files. (e.g., $APPDIR=$HOME/godoc-app) * $APPDIR contains the following entries (this may change depending on app-engine release and version of godoc): app.yaml golang.org/x/tools/cmd/godoc godoc.zip index.split.* * The app.yaml file is set up per app engine documentation. For instance: application: godoc-app version: 1 runtime: go api_version: go1 handlers: - url: /.* script: _go_app Configuring and running godoc ----------------------------- To configure godoc, run bash setup-godoc-app.bash to prepare an $APPDIR as described above. See the script for details on usage. To run godoc locally, using the App Engine development server, run <path to go_appengine>/dev_appserver.py $APPDIR godoc should come up at http://localhost:8080 .