The code to serve the golang.org website has been moved to
the golang.org/x/website sub-repository. x/website has become
the canonical source of the golang.org website as of CL 162157,
and so this code can be removed from here now.
This has the benefit of removing some external dependencies
that were only used by the website in production mode, and
in turn enabling x/tools to be a smaller tools-related module.
In future changes, the golang.org/x/tools/cmd/godoc command
will be reduced in scope to be a tool for serving Go package
documentation only, not the rest of the golang.org website.
Run go mod tidy (using Go 1.12 RC 1).
Updates golang/go#29206
Updates golang/go#29981
Change-Id: I61fd25627d0506901b04688dea8d8c9da9fe8f04
Reviewed-on: https://go-review.googlesource.com/c/162400
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Channing Kimble-Brown <channing@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
This change adds a small number of integration tests for the godoc
command's -url flag, confirming that the behavior matches the local http
server tests in those cases. It fixes three bugs which prevent the -url
flag from working currently.
Fixesgolang/go#30259Fixesgolang/go#30260Fixesgolang/go#30261
Change-Id: I0ca1fe81f9f186d0ca02b31674cc8654af434e92
Reviewed-on: https://go-review.googlesource.com/c/162907
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Change CL 153869 added a help message when there are leftover arguments,
as that used to invoke the command-line interface that is now gone.
But the example in the help text (go doc -all net/http) generates a huge
amount of output.
Use a very simple, small-output example instead, to illustrate how to
solve the problem without scrolling the program description hundreds
of screenfuls away.
Change-Id: I1887af1f3e853bf3a852dc374746074f1cd39441
Reviewed-on: https://go-review.googlesource.com/c/155157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The command-line interface was recently removed in favor of "go doc".
Change-Id: Idfcfca3b2eafaf63148a2ed88d4d25c61d9e3c69
Reviewed-on: https://go-review.googlesource.com/c/153869
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
- Removed all documentation which referred to godoc's CLI capabilities.
- Added some missing flags which were not documented.
- Removed some redundant mentions of "web server" because now it is
just a web server.
- Converted some links to https
Change-Id: I7ddcf417d2bc3df13183adcfd0f82af9a37a1b91
Reviewed-on: https://go-review.googlesource.com/c/143077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The corpus needs to be init'd before generating the index.
Regression caused by CL 141397.
Updates golang/go#25443.
Change-Id: I04d19bf5d279031cc8ddf0f850d81eb06fc5efa8
Reviewed-on: https://go-review.googlesource.com/c/141717
Run-TryBot: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
httptest assumes it's running a test, it registers its own flags, which
means godoc ends up with mysterious flags.
By implement an http.ResponseWriter, we do not need to use httptest.
Fixesgolang/go#28138
Change-Id: Ia0de8597c3edb0e7bdea6d8b3b2f1618a12f9239
Reviewed-on: https://go-review.googlesource.com/c/141417
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
godoc is now just a webserver (the one that runs golang.org)
A future change might rename this to something else, but not now.
Fixesgolang/go#25443
Change-Id: Ib95d0589e13f4c7a717ff28d694f1472e427eef4
Reviewed-on: https://go-review.googlesource.com/c/141397
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
See bug for more details on exactly what was migrated.
Notably:
* No more Google-internal deployment scripts; see README.godoc-app and
the Makefile for details.
* Build tag "golangorg" is used for the godoc configuration used for
golang.org.
* Use of App Engine libraries replaced with GCP client libraries.
* Redis is used to replace App Engine memcache.
* Google analytics is controlled by an environment variable.
* Regression tests have been migrated from Google-internal.
* hg -> git hash map is moved from Google-internal.
Updates golang/go#27205.
Change-Id: Ia0a983f239c50eda8be2363494c8b784f60c2c6d
Reviewed-on: https://go-review.googlesource.com/133355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The logic to determine whether a filesystem root was in GOROOT or GOPATH
still relied on runtime.GOROOT(), whereas cmd/godoc was updated to copy
the goroot finding logic from standard library.
Hence, godoc is unable to determine if a filesystem is in GOROOT or not
when the binary is outside runtime.GOROOT(). So we expose a new variable
and set that from cmd/godoc to avoid copying the logic again for the 3rd time.
Fixesgolang/go#27162
Change-Id: I160dcdbdd262e671f09f7bf01c329be5eac280ad
Reviewed-on: https://go-review.googlesource.com/130796
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
This change reads $GOROOT/api/go1.*.txt when godoc starts and caches
information about which versions of Go introduce functions, types, and
methods. This information is displayed currently only in HTML output.
Functions, types, and methods introduced as part of Go 1 are not
annotated, as their presence at that version is implied.
This change does not address constants or variables, and completely
ignores the syscall package. The former are future work, the latter is
likely an exercise in futility. In all cases, this is because the story
around displaying the version information is not well developed.
Fixesgolang/go#5778
Change-Id: Ieb3cc0da7b18e195bc9c443f14fd8a82e8b2bbf8
Reviewed-on: https://go-review.googlesource.com/85396
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Devon O'Dell <dhobsd@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
- Setting the GOROOT build path to the value passed from the command line.
- Clarified the return values to named parameters for extra clarity.
- And while here, added some missed out error handling. Just logging the error
to preserve original behavior.
Fixesgolang/go#13296
Change-Id: I91427eee790928a3cfb51ae207747e9a17bd5496
Reviewed-on: https://go-review.googlesource.com/110275
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This flag includes unexported identifiers in command-line mode.
It is equivalent to ?m=all in web mode.
Fixesgolang/go#8093
Change-Id: I1e5a69626929d3430638d900f3e975b272a98c90
Reviewed-on: https://go-review.googlesource.com/99435
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
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
Note: This is a re-do of a previous CL golang.org/cl/88695 which was
incorrect committed without running tests. This CL fixes that test.
Fixesgolang/go#13278
Change-Id: I80c801f32af007312090d3783a2ea2c6f92cad66
Reviewed-on: https://go-review.googlesource.com/93215
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
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
Fixesgolang/go#13278
Change-Id: I0505acc1c190423d09fb199b11ca86e0400e84d4
Reviewed-on: https://go-review.googlesource.com/88695
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Found with honnef.co/go/tools/cmd/unused.
Change-Id: I3db2aad14de33f0be69569cd355e453173098358
Reviewed-on: https://go-review.googlesource.com/37599
Reviewed-by: Alan Donovan <adonovan@google.com>
Explain how to make changes to the project's static files and get them compiled
in to the godoc binary.
Change-Id: I12e0c50bf31925b3f211b6d0dd3e5f8cff547f32
Reviewed-on: https://go-review.googlesource.com/34925
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
If built with the "autocert" build tag, use
golang.org/x/crypto/autocert and for automatic TLS certs.
This will be used for https://beta.golang.org/ running on GCE.
Change-Id: Id0e385796a25d663708ea9bb65c45cb1471dd526
Reviewed-on: https://go-review.googlesource.com/33751
Reviewed-by: Chris Broadfoot <cbro@golang.org>
On tip, search included redundant source results from /pkg/bootstrap
(with broken links as godoc doesn't support source files under /pkg).
This change excludes all directories under /pkg from indexing.
Fixesgolang/go#10024.
Change-Id: I0c69d22ff08d131f9c37c91a7711db6a4ec53fd4
Reviewed-on: https://go-review.googlesource.com/7267
Reviewed-by: Andrew Gerrand <adg@golang.org>
Rewrite performed with this command:
sed -i '' 's_code.google.com/p/go\._golang.org/x/_g' \
$(grep -lr 'code.google.com/p/go.' *)
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/170920043
To avoid breaking URLs, we redirect /src/pkg/* to /src/*.
The URL /pkg is now the "directory" /src, which triggers the
"Packages" index.
All other references to "src/pkg" are now gone,
except a number in the namespace documentation which are
probably still illustrative.
Tested: go test cmd/godoc godoc
Manual inspection of src and src/pkg pages.
with GOROOT and GOPATH packages
-analysis
/AUTHORS file URL still works
LGTM=bradfitz, adg
R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/141770044
In command godoc, set IndexEnabled when the -write_index flag is set.
Previously you would need to (unintuitively) set the -http flag to
achieve this.
In package godoc, set up the FS tree before loading the index, and
then return before starting the index refresh loop. Previously the
index would be loaded and then immediately refreshed, negating the
benefits of the on-disk index.
TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/103370046
The text and images are "baked in" to the godoc executable's
rodata section (~300KB) and are accessible from the godoc
server itself at /lib/godoc/analysis/help.html.
In due course, the page will become visible at
http://golang.org/lib/godoc/analysis/help.html, which will be
the canonical location for this doc (in announcements, etc).
The page is temporarily visible here, for those on the Google corp network:
http://172.26.104.127:7777/lib/godoc/analysis/help.html
Also:
- add link to new doc from source view pages.
- document -analysis flag in cmd/godoc/doc.go
- fix indentation of -analysis flag's help string
LGTM=gri
R=gri, bgarcia, r
CC=golang-codereviews
https://golang.org/cl/87110045
See analysis.go for overview of new features.
See README for known bugs and issues.
Much UI polish, testing and optimization work remains, but
this is a starting point.
Flag: we add a new flag -analysis=type,pointer, default "",
for adventurous users only at this stage.
Type analysis takes ~10s for stdlib + go.tools;
Pointer analysis (currently) takes several minutes.
Dependencies: we now include jquery.treeview.js and its GIF
images among the resources. (bake.go now handles binary.)
LGTM=crawshaw, bgarcia
R=crawshaw, bgarcia
CC=bradfitz, golang-codereviews
https://golang.org/cl/60540044
Not for Go 1.2. Still needs a flag.
Linux at least (and likely other OSes) don't like you doing
a few hundred readdirs at once and spawing as many threads.
R=golang-dev, adg, jeremyjackins
CC=golang-dev
https://golang.org/cl/30620043
Add explicit options to Corpus to control search indexing of documentation, Go source code, and full-text.
R=bradfitz, r
CC=golang-dev
https://golang.org/cl/24190043
Also move some common code from main.go to handlers.go, and
exclude remotesearch.go from the appengine build (it is only
relevant to the command line interface).
R=bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/12001049
The exported Server becomes handlerServer, and part of Presentation
now. Presentation is also now an http.Handler with its own
internal mux (a detail, which might go away).
main.go becomes ever simpler.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11505043
cmd/godoc/godoc.go is now merged into main.go, which is now
only 530 lines.
App Engine mode is still broken, but should be easy to fix up.
(just needs a global *godoc.Presentation created in init)
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11498044