This feature should make it easier to look at very large
directory trees.
- a new mode (URL: /pkg/?m=flat) shows directory listings w/o
indentation and entries with full path (html and text mode)
- in text mode, hierarchical (non-flat) directory listings are
now presented with indentation (/pkg/?m=text)
- in html mode, hierarchical (non-flat) directory listings are
presented with slightly less indentation
- there is an internal hook for programmatic control of the
display mode (for specialized versions of godoc).
R=bradfitz
CC=golang-dev, rsc
https://golang.org/cl/5410043
1. Generate TOC for package pages using template,
instead of using JavaScript magic. This makes the
pages generated by godoc -html easier to export
to other systems.
2. Make TOC one column. It's hard to do two columns
portably without invoking JavaScript.
3. Since the TOC is only one column, show full type
signatures for functions and methods. Many times
that's all you need to see anyway.
4. Name the section after the TOC "Overview".
Naming it something is important, to set it off
from the TOC and so that there's a quick link to
it in the TOC.
For now, some illustrative examples:
http://swtch.com:6060/pkg/io/http://swtch.com:6060/pkg/strings/http://swtch.com:6060/pkg/tabwriter/http://swtch.com:6060/pkg/unicode/Fixes#1982.
R=gri, bradfitz, r
CC=golang-dev
https://golang.org/cl/5303044
This CL introduces the go.Example type and go.Examples functions that
are used to represent and extract code samples from Go source.
They should be of the form:
// Output of this function.
func ExampleFoo() {
fmt.Println("Output of this function.")
}
It also modifies godoc to read example code from _test.go files,
and include them in the HTML output with JavaScript-driven toggles.
It also implements testing of example functions with gotest.
The stdout/stderr is compared against the output comment on the
function.
This CL includes examples for the sort.Ints function and the
sort.SortInts type. After patching this CL in and re-building go/doc
and godoc, try
godoc -http=localhost:6060
and visit http://localhost:6060/pkg/sort/
R=gri, r, rsc
CC=golang-dev
https://golang.org/cl/5137041
Also: fix layout of textual search results and
fix a field reference in the respective template.
Fixes#1987.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4962061
- KindRuns don't need to repeat SpotKind,
it is stored in each Spot
- removed extra indirection from FileRuns
to KindRuns
- slight reduction of written index size
(~500KB)
R=rsc
CC=golang-dev
https://golang.org/cl/4969052
Use naming convention for template variables
to indicate "escaped-ness" for easier reviewing.
(per suggestion from bradfitz)
R=bradfitz
CC=golang-dev
https://golang.org/cl/4914041
Since the posLink_url also adds a non-URL attribute, the quoting and URL-escaping
must happen inside posLink_url (otherwise the non-URL attribute becomes part or the
URL portion of the tag.
R=r
CC=golang-dev
https://golang.org/cl/4888041
- rename template funcs for better consistency and
sort them into groups of related functionality
- try to be more consistent with html vs url escaping
R=r
CC=golang-dev
https://golang.org/cl/4887041
- simplified pipelines
- simplified templates by using template variables
- converted most old-style formatters into new-style funcs
- fixed some escaping bugs (use of url escaping where it was missing)
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4868044
- first step; rough conversion of all template files
- there is plenty of opportunity for cleanups/simplifications (next CLs)
- html and text output as before
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4852048
Uses placeholder attribute instead of changing the value of search
field on browsers that support it. On other browsers, the fake
placeholder text is restored when the empty box loses focus.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4441041
Neither gofmt nor godoc are making use of a Styler (for
token-specific formatting) anymore. Stylers interacted in complicated
ways with HTML-escaping which was why the printer needed an HTML mode
in the first place.
godoc now uses a more powerful and general text formatting
function that does HTML escaping, text selection, and can
handle token-specific formatting if so desired (currently
used only for comments).
As a consequence, cleaned up uses of go/printer in godoc;
simplified the various write utility functions, and also
removed the need for the "html" template format (in favor of
html-esc which now does the same and is used more pervasively).
Applied gofmt -w src misc to verify no changes occured,
and tested godoc manually.
There should be no visible changes except that (type) code
snippets presented for godoc package documentation now
uses the same formatting as for general source code and
thus comments get the comment-specific color here as well
(not the case at the moment).
(TODO: godoc needs a good automatic test suite).
R=rsc
CC=golang-dev
https://golang.org/cl/4152042
- added flag -maxresults (default: 10000) to limit the max.
number of full text results shown
- removed flag -fulltext; use -maxresults=0 to disable fulltext
index
- better indication on result page if not all results are shown
(... after line list)
R=rsc, gri1
CC=golang-dev
https://golang.org/cl/4049042
Regular expressions may now be used in conjuction with full text
search. Godoc will show the first 10000 occurences in the source
code and highlight the respective text segments.
- added new flag -testDir to specify a small directory for testing
(fast index creation; default = "")
- use new FormatText function to format text and Go source
code in HTML, supporting multiple kinds of text selections
simulatenously); this replaces the uses of go/printer
Stylers
- for now removed currently unused mechanism for identifier-
specific JS popups (will come back in some form once we
have type or other useful information)
- various typo fixes and minor cleanups throughout
Missing:
- indexing of non-.go files
R=r, r2
CC=golang-dev, rsc
https://golang.org/cl/3699041
changeset: 6839:545c9926d61a
user: Robert Griesemer <gri@golang.org>
date: Mon Dec 06 14:23:18 2010 -0800
summary: go/ast: use token.Pos instead of token.Position; adjust all dependent code
broke 'godoc -src fmt', one of the example uses of godoc. It gives a stack backtrace essentially
caused by dereferencing a NULL pointer (in C terms). This change fixes the particular issue, but
the code probably should be made more robust.
Fixes#3818044.
R=gri
CC=golang-dev
https://golang.org/cl/3818044
- improved search result page
- clicking on files shows highlighted search phrase
(.go files loose their godoc-specific formatting and
highlighting in this mode - a better solution is in
the works)
- support for textual results
- fixed bug with non-URL escaped URL parameter (Query)
R=rsc, adg
CC=golang-dev
https://golang.org/cl/3585041
To enable use -fulltext flag; e.g.: godoc -v -fulltext -http=:7777
Enabling the fulltext index will use significantly more memory as
the text of all source code, the respective suffixarray, and the
file set data structure is kept in memory. At the moment there is
about 6Mb of source code (~1400 files) indexed under GOROOT.
Source code + suffix array together consume 5*(size of source) or
about 30Mb. The file set data structure consumes about 4b/src line.
By default only up to 5000 results are shown for now.
The presentation of the results needs tuning. In particular,
if a string is found, clicking on the respective file does not
highlight them, yet.
At the moment, only Go source files are indexed. Eventually,
the full text index should encompass other files as well.
R=rsc, adg
CC=golang-dev
https://golang.org/cl/3182043
Specifically:
* lib/godoc:
- provide file set (FSet) argument to formatters where needed
* src/cmd:
- cgo, ebnflint, godoc, gofmt, goinstall: provide file set (fset) where needed
- godoc: remove local binary search with sort.Search (change by rsc),
extract file set for formatters
* src/pkg:
- exp/eval: remove embedded token.Position fields from nodes and replace
with named token.Pos fields; add corresponding Pos() accessor methods
- go/token: added file.Line(), changed signature of File.Position()
* test/fixedbugs/:
- bug206.go: change test to not rely on token.Pos details
* added various extra comments
* Runs all.bash
* gofmt formats all of src, misc w/o changes
* godoc runs
* performance:
- The new version of godoc consumes about the same space after indexing
has completed, but indexing is half the speed. Significant space savings
are expected from smaller ASTs, but since they are thrown away after a
file has been indexed, this is not visible anymore. The slower indexing
time is due to the much more expensive computation of line information.
However, with the new compressed position information, indexing can be
rewritten and simplified. Furthermore, computing the line info can be
done more efficiently.
New godoc, immediately after indexing completed (best of three runs):
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
44381 godoc 0.0% 0:38.00 4 19 149 145M 184K 148M 176M
2010/12/03 17:58:35 index updated (39.231s, 18505 unique words, 386387 spots)
2010/12/03 17:58:35 bytes=90858456 footprint=199182584
2010/12/03 17:58:36 bytes=47858568 footprint=167295224
Old godoc, immediately after indexing completed (best of three runs):
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE
23167 godoc 0.0% 0:22.02 4 17 132 129M 184K 132M 173M
2010/12/03 14:51:32 index updated (24.892s, 18765 unique words, 393830 spots)
2010/12/03 14:51:32 bytes=66404528 footprint=163907832
2010/12/03 14:51:32 bytes=46282224 footprint=163907832
The different numbers for unique words/spots stem from the fact the the
two workspaces are not exactly identical. The new godoc maintains a large
file set data structure during indexing which (probably) is the reason
for the larger heap (90858456 vs 66404528) before garbage collection.
R=rsc, r
CC=golang-dev
https://golang.org/cl/3050041
The front page remains fixed-width.
All other pages should look good in windows >=500px wide.
Includes additional styles for search result highlighting,
code comments, and general CSS clean-ups.
Tested with Chrome 6, Firefox 3.6, IE 7, and IE 8.
R=gri, r
CC=golang-dev
https://golang.org/cl/2229041
- change ast.Ident back to contain the name and adjust all dependent code
- identifier object information will be added again through an optional
typechecker phase (in the works).
- remove tracking of scopes in parser - it's easier to do this in a separate
phase (in the works)
- in godoc, generate popup info table directly instead of through a formatter
for simpler data flow (at the expense of a little bit more code)
Runs all tests.
As a result of this change, the currently shown popup information
(const, var, type, func, followed by identifier name) will not be
shown anymore temporarily.
R=rsc
CC=golang-dev
https://golang.org/cl/1994041
This is a stop-gap change to give more current information visibility
before a more thorough reorganization.
R=r, rsc, gri
CC=golang-dev
https://golang.org/cl/1902042
- change the various url-xxx formatters to return a relative URL path
- make the leading '/' for URLs explicit in the template
- on the way change some |html formatters to |html-esc
(html should only be used for formatting AST nodes)
R=rsc, r
CC=golang-dev
https://golang.org/cl/740041
Instead of returning the index lookup result via
RPC which has to be corrected for the client,
simply render it on the server and return the
final output.
R=rsc, r
CC=golang-dev
https://golang.org/cl/669041
The command-line search is using a running webserver
as index server; i.e., the search result is reflecting
the index at the server. See the documentation for
details.
Usage: godoc -q query1 query2 ...
Known issue: Results don't show the all-important
line numbers yet due to the way the index is organized.
Next CL.
R=rsc, r
CC=golang-dev
https://golang.org/cl/648041
for identifiers in Go source code
- at the moment just show identifier kind (var, func, etc.) and name
(eventually should show declaration, type, etc.)
- JavaScript parts by adg
R=rsc
CC=adg, golang-dev
https://golang.org/cl/578042
- on the commandline: godoc -x big
- in a webpage: provide form parameter ?m=src
Known issues:
- Positioning of comments incorrect in several cases. Separate CL.
- Need a link/menu to switch between different modes of presentation
in the web view.
R=rsc
CC=golang-dev
https://golang.org/cl/376041
Example use: godoc -path=/home/user1:/home/build/foo -http=:6666
will start a local godoc that maps urls starting with /pkg/user1 or
/pkg/foo to the respective roots specified in the path.
Missing: Handling of overlapping package directories, multiple
packages per directory.
R=rsc
CC=golang-dev
https://golang.org/cl/206078
- simplified dealing with parse errors: no need to intersperse them in the source
- improve visibility of highlighted identifiers by showing them in bold
R=rsc
https://golang.org/cl/163051
- When providing alternative spellings to a query, do not
prefix it with a package qualifier as the suggestion may
not have any results. Correctly filtering is quite a bit
of work, and clicking the alternative spelling will always
also show the qualified hits if they exist (but also others).
Seems good enough for now.
- Give user feedback when the query syntax was wrong.
- Package names in search results are now links to the respective
package documentation.
- Experimented with excluding main packages and test files
from index with inconclusive results. Code is present and
can be enabled by changing a flag in the source. This needs
some more work.
R=rsc
CC=r, dsymonds
http://go/go-review/1026033
- introduced a new run per file containing all spots belonging
to the same kind (e.g. var decl, const decl, etc.)
- more comments, better index.go file organization
R=rsc
http://go/go-review/1026028
(this was surprisingly hard to get right in HTML)
- show modification times in source directory listings
- various tweaks
R=rsc
http://go/go-review/1024024
- formatting in dirs.html is crude, needs better html (open to suggestions),
but shows the synopsis
- many package comments should probably be adjusted such that the first
sentence is more concise
R=rsc, iant
http://go/go-review/1025014
just a single directory
- all pieces present but not well integrated
- directory tree served at the moment under /tree
R=rsc
http://go/go-review/1018016
- replaced deprecated use of </font> with </span> tag
- added html escaping to godoc formatters where missing
- enabled text format for package documentation
R=rsc
http://go/go-review/1017001
- sort by package name (instead of package path) for results with snippets
- sort line numbers in results without snippets
- properly characterize package clauses
- experiment with a leaner look: no underlines for top-level godoc links in the left side bar
Still using colors to distinguish results. Next step.
R=rsc
http://go/go-review/1015016
- added goroutine to automatically index in the background
- added handler for search requests
- added search box to top-level godoc template
- added search.html template for the display of search results
- changes to spec.go because of name conflicts
- added extra styles to style.css (for shorter .html files)
R=rsc
http://go/go-review/1014011
- the first HTML comment in those files is extracted as page
title when serving them
- lib/godoc.html is top-level template for all pages served
- experimented a bit with package documentation layout
(feedback welcome)
- various related cleanups
TODO:
- The / page (doc/root.html) content repeats links that are
in the navigation bar. It needs to be cleaned up.
R=rsc
DELTA=826 (86 added, 692 deleted, 48 changed)
OCL=35230
CL=35245