1
0
mirror of https://github.com/golang/go synced 2024-11-13 17:40:23 -07:00
Commit Graph

207 Commits

Author SHA1 Message Date
Andrew Gerrand
af1ae438b9 go/doc, godoc, gotest: support for reading example documentation
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
2011-10-06 11:56:17 -07:00
Russ Cox
351e1d5745 codereview: fix for Mercurial 1.9.2
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5127052
2011-10-05 12:08:41 -04:00
Yasuhiro Matsumoto
319dba4750 codereview: fix hg change in Windows console
lib/codereview: Unable to use vim for 'hg change' from windows console
reload(sys) break workaround for windows.
see:
http://mercurial.selenic.com/bts/issue2888
http://mercurial.selenic.com/bts/issue1452
Also does not work with backslash paths.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5150054
2011-10-05 12:07:13 -04:00
Russ Cox
1fa87ada55 codereview: extra repo sanity check
Also work around Mercurial issue 3023.

If anyone has local changes in their repo (due to
patch queues or whatever) stop them from leaking
into the main repository.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5144043
2011-09-26 18:32:16 -04:00
Russ Cox
762729b50e codereview: save CL messages in $(hg root)/last-change
Fixes #2279.

R=bradfitz, r, r
CC=golang-dev
https://golang.org/cl/5096042
2011-09-20 14:56:15 -04:00
Robert Griesemer
dc9ee812ba godoc: fine tuning of template file
R=r, adg
CC=golang-dev
https://golang.org/cl/4995041
2011-09-08 18:27:26 -07:00
Robert Griesemer
041dc0a1c2 godoc: show packages matching a query at the top
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
2011-09-08 15:35:56 -07:00
Robert Griesemer
72dcab1c40 godoc: fix local link for factory functions
- fix suggested by rodrigo.moraes

Fixes #1755.

R=rsc
CC=golang-dev
https://golang.org/cl/4977057
2011-09-08 10:37:26 -07:00
Russ Cox
e7af22a64e codereview: Mercurial 1.9 fix for hg diff @nnn
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4969063
2011-09-08 10:08:49 -04:00
Robert Griesemer
3f1269ff1e godoc: more index size reduction
- 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
2011-08-31 14:01:58 -07:00
Robert Griesemer
0f801ff81e godoc: template cleanup
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
2011-08-17 16:38:58 -07:00
Robert Griesemer
e6ae13d35d godoc: fix lib/godoc/package.txt template
- show documentation in text mode; e.g.:
http://localhost:7777/cmd/godoc/?f=text

- simplify template by using $ variable

R=r, adg
CC=golang-dev
https://golang.org/cl/4873045
2011-08-15 15:42:27 -07:00
Robert Griesemer
91fadbca17 godoc: fix escaping in templates
- HTML-escape URL paths
- URL-escape URL parameters

R=bradfitz
CC=golang-dev
https://golang.org/cl/4890041
2011-08-15 15:15:54 -07:00
Andrew Gerrand
df3df7b70a godoc: fix godoc.html template bug: correctly display package roots
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4898042
2011-08-14 08:56:47 +10:00
David Symonds
5e48e648f1 exp/template: rename filter: url -> urlquery.
R=r, rsc
CC=golang-dev
https://golang.org/cl/4873046
2011-08-13 14:00:16 +10:00
Robert Griesemer
c71b676724 godoc: position URLs (containing file names) must be quoted and URL escaped
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
2011-08-12 16:28:55 -07:00
Robert Griesemer
5c45e56898 godoc: remove last vestiges of old template system
- 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
2011-08-12 15:43:10 -07:00
Robert Griesemer
5233c50321 godoc: first round of template cleanups
- 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
2011-08-12 10:06:32 -07:00
Mikio Hara
8d19d6bb39 lib/godoc: fix typo
R=gri, dsymonds
CC=golang-dev
https://golang.org/cl/4881042
2011-08-12 22:42:42 +10:00
Robert Griesemer
2e394c51d9 godoc: moving to new template package
- 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
2011-08-11 13:24:13 -07:00
Russ Cox
d118905c2c codereview: set status while committing CL
Not sure how to detect read-only but at least
this pins the blame on the hg server.

R=r, bradfitz
CC=golang-dev
https://golang.org/cl/4847053
2011-08-10 21:36:59 -04:00
Robert Griesemer
8930ce2dc1 godoc: implement http.FileSystem for zip files
R=rsc, adg, bradfitz
CC=golang-dev
https://golang.org/cl/4750047
2011-07-19 08:22:20 -07:00
Andrew Gerrand
87d71a3815 codereview: fix for Mercurial 1.9
R=golang-dev, mirtchovski, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/4686049
2011-07-11 22:58:40 -04:00
Andrew Gerrand
b4f0e8ffd3 undo CL 4675045 / 0e11e08951f7
Breaks Mercurial 1.8.3.

««« original CL description
codereview: fix for Mercurial 1.9

Fixes #2038.

R=rsc, bobbypowers
CC=golang-dev
https://golang.org/cl/4675045
»»»

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4685055
2011-07-12 09:57:39 +10:00
Andrew Gerrand
762ea79057 codereview: fix for Mercurial 1.9
Fixes #2038.

R=rsc, bobbypowers
CC=golang-dev
https://golang.org/cl/4675045
2011-07-12 09:36:46 +10:00
Russ Cox
3379414b21 codereview: restrict sync to default branch
'default' is the name of the main branch,
the one that isn't a release branch.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4636072
2011-06-29 00:45:29 -04:00
Russ Cox
f79bcb4b86 codereview: make --ignore_hgpatch_failure work again
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4627067
2011-06-27 13:45:17 -04:00
Robert Hencke
58ff8c1dfd codereview.py: note that hg change -d abandons a change list
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4644043
2011-06-20 14:50:00 -04:00
Andrew Gerrand
e015f6c4a5 godoc: display advert for the package dashboard on package list page
R=golang-dev, bradfitz, ality
CC=golang-dev
https://golang.org/cl/4526070
2011-05-24 15:45:08 +10:00
Andrew Gerrand
2fe4dd7ad3 godoc: remove paragraph tags around navigation div
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4551051
2011-05-20 15:32:01 +10:00
Russ Cox
404d49154b codereview: handle 'null as missing field' in rietveld json
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4543046
2011-05-13 11:17:06 -04:00
Russ Cox
71102ad25b codereview: fix clpatch
TBR=gri
CC=golang-dev
https://golang.org/cl/4534052
2011-05-12 23:11:52 -04:00
Russ Cox
9d2a697fb9 codereview: fetch metadata using JSON API, not XML scraping
Fixes hg clpatch.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/4524045
2011-05-11 23:26:52 -04:00
Russ Cox
35a37f1735 codereview: add release branch support
Note that if you are working on the upcoming release
branch you have to point your extension path to a
copy of lib/codereview/codereview.py that won't change
as the repository flips between release-branch and default branch.
This warning should only apply to this one branch and only to rsc,
but you never know.

R=adg
CC=golang-dev
https://golang.org/cl/4446076
2011-05-03 10:39:11 -04:00
Robert Griesemer
c783e68ff5 godoc: added -index flag to enable/disable search index
Fixes #1647.

R=adg, rsc1, r2, rsc, r
CC=golang-dev
https://golang.org/cl/4444083
2011-05-02 13:28:02 -07:00
Russ Cox
4efdeeec51 codereview: various fixes
Set mailed bit correctly for self-clpatch.
Use repo.rollback correctly.
Allow leading spaces in some C code.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4438064
2011-04-25 12:12:53 -04:00
Russ Cox
0c6df25df1 codereview: add 'hg undo' command
R=adg, r
CC=golang-dev
https://golang.org/cl/4423045
2011-04-17 14:15:51 -04:00
Dmitry Chestnykh
84c7e83b4c godoc: use "search" input type for search box.
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
2011-04-15 10:48:45 -07:00
Russ Cox
740051ae75 codereview: automatically port old diffs forward
In the current codereview, if a patch was written against
a version of a file that had subsequently been edited,
hg clpatch would fail, even if the patch and the edits were
in different parts of the file.  In this situation the reviewer
typically wrote back saying "please hg sync and hg mail
to update the patch".

This change rewrites the patch automatically, using the
same transformation that hg sync + hg mail would.

If the interim changes (since the patch was created)
affect the same line ranges as the patch, clpatch will
still refuse to apply it.  But this CL should make
of the trivial conflicts we see just go away.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4377046
2011-04-08 13:00:40 -04:00
Russ Cox
88bbf4f1df codereview: fix clpatch
I love Python.  Write once, crash anywhere.

TBR=r
CC=golang-dev
https://golang.org/cl/4382043
2011-04-07 13:06:02 -04:00
Russ Cox
710028d3a4 codereview: drop Author: line on self-clpatch
Right now if a Go developer makes a patch on one machine
and then clpatches it onto another machine, changes
subsequently made to the description are kept only
locally, under the assumption that you are running
clpatch because someone else wrote the CL, so you
don't have permission to update the web.

This change makes clpatch discard the "this was a
clpatch" information from the metadata when you
clpatch your own CLs from one machine to another.

This should eliminate some confusion (for example
in CL 4314054) but will no doubt introduce other
confusion.

R=golang-dev, r2
CC=golang-dev
https://golang.org/cl/4387041
2011-04-07 13:03:06 -04:00
Russ Cox
5b0ef4ac1f codereview: recognize code URL without trailing slash
R=adg
CC=golang-dev
https://golang.org/cl/4385042
2011-04-06 23:07:08 -04:00
Russ Cox
36c009d465 codereview: only retry on HTTP 500 error
R=r
CC=golang-dev
https://golang.org/cl/4353047
2011-04-04 15:47:32 -04:00
Robert Griesemer
c98145fb50 godoc: fix spelling error
R=r, r2
CC=golang-dev
https://golang.org/cl/4289079
2011-03-28 15:55:48 -07:00
Andrew Gerrand
5dd0869bf5 codereview: permit CLs of the form weekly.DATE
gobuilder: recognize CLs of the form weekly.DATE

R=rsc, r
CC=golang-dev
https://golang.org/cl/4282052
2011-03-17 09:11:08 +11:00
Robert Hencke
1ddc27888b codereview.py: do not suggest hg change -d if current user is not CL author
R=golang-dev, rsc1, rsc
CC=golang-dev
https://golang.org/cl/4253064
2011-03-08 12:23:06 -05:00
Gustavo Niemeyer
73aacbda20 codereview: fix clpatch with empty diffs
Avoid passing the placeholder diff to hgpatch, so that
clpatch-ing an empty diff grabs the metadata and warns
about it being empty, rather than failing with a
hard-to-debug problem ("mkdir: no such file or dir",
no metadata, etc).

R=rsc
CC=golang-dev
https://golang.org/cl/4172060
2011-02-23 11:48:40 -05:00
Robert Griesemer
d916cca327 go/printer: remove notion of "Styler", remove HTML mode
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
2011-02-09 09:52:32 -08:00
Yasuhiro Matsumoto
3108f3f4a0 codereview: use cmd.communicate.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4145046
2011-02-08 22:30:06 -05:00
Yasuhiro Matsumoto
27191b558c codereview: fix hgpatch on windows
R=rsc
CC=golang-dev
https://golang.org/cl/3989059
2011-02-02 22:43:40 -05:00