1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:26:11 -07:00
go/cmd/godoc
Agniva De Sarker f86b507a7e godoc: init corpus in a separate goroutine in http mode
Currently, in http mode the server blocks until the corpus
has been initialized. This can cause considerable delay
if the user workspace is significantly large and the files
are not present in the buffer cache.

This CL spawns off the initialization in a separate goroutine
if httpMode is set and turns on a flag when it's done.
The http handler checks the flag and returns an error response
if it has not been set.

The check is only performed for the path prefixes handled by the
handlerServer struct. Other paths do not call the GetPageInfo() function
and hence can return immediately. This preserves maximum responsiveness
of the server.

Also adds an additional print statement in verbose mode

Fixes golang/go#13278

Change-Id: I0505acc1c190423d09fb199b11ca86e0400e84d4
Reviewed-on: https://go-review.googlesource.com/88695
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-23 16:04:43 +00:00
..
appinit.go cmd/godoc: serve proxy paths without host enforcer 2015-09-23 05:23:18 +00:00
autocert.go cmd/godoc: optional ACME autocert support 2016-11-30 23:52:24 +00:00
blog.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
codewalk.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
dl.go godoc/{dl,proxy,short}: move packages out of Google's internal repo 2015-09-23 03:53:05 +00:00
doc.go cmd/godoc: Fix package comment inconsistencies. 2017-03-04 00:53:44 +00:00
godoc19_test.go cmd/godoc: fix expected test output for Go 1.8 and older 2017-04-26 05:21:38 +00:00
godoc_test.go all: fix plan9 build 2017-11-29 20:22:11 +00:00
handlers.go cmd/godoc: allow golang.google.cn as a valid host 2018-01-20 03:13:38 +00:00
index.go cmd/godoc: exclude /pkg from search indexing 2015-03-12 00:26:38 +00:00
main.go godoc: init corpus in a separate goroutine in http mode 2018-01-23 16:04:43 +00:00
play.go cmd/godoc: always serve fmt handler, HTTPS fix redirection 2015-09-25 02:10:07 +00:00
README.godoc-app go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
remotesearch.go go.tools/cmd/godoc: update appinit.go to use new godoc packages 2013-07-30 14:23:23 +10:00
setup-godoc-app.bash godoc: proxy /compile requests to play.golang.org 2018-01-04 23:58:58 +00:00
x.go cmd/godoc: add perf subrepo 2016-12-20 20:09:41 +00:00

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 .