Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(159)

Issue 5440100: code review 5440100: godoc: Allow examples for methods. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 3 months ago by volker.dobler
Modified:
13 years, 3 months ago
Reviewers:
CC:
golang-dev, adg, r2, rsc, dupoxy, r
Visibility:
Public.

Description

godoc: Allow examples for methods. An example for a method M() of type T can be written as func ExampleT_M() { ... }. To differentiate between multiple examples for one function, type or method a suffix with a lowercase start may be appended to the name of the example function, e.g. ExampleFoo_basicUsage. Fixes issue 2465.

Patch Set 1 #

Patch Set 2 : diff -r adff3701bfc7 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r adff3701bfc7 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 4 : diff -r 778c06919be6 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 77404a124c34 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 648ada5634e3 https://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 7 : diff -r e25954278b04 https://go.googlecode.com/hg/ #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+24 lines, -5 lines) Patch
M src/cmd/godoc/godoc.go View 1 2 3 4 5 6 2 chunks +15 lines, -3 lines 0 comments Download
M src/cmd/gotest/doc.go View 1 2 3 4 5 1 chunk +9 lines, -2 lines 1 comment Download

Messages

Total messages: 18
volker.dobler
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 3 months ago (2011-12-05 10:24:03 UTC) #1
adg
I'm having second thoughts about the numbers-only restriction. What about this: For a package containing ...
13 years, 3 months ago (2011-12-05 23:58:28 UTC) #2
r2
Agree. I dislike the naming (numbering) convention introduced here. It's so 1963. -rob
13 years, 3 months ago (2011-12-05 23:59:39 UTC) #3
adg
http://codereview.appspot.com/5440100/diff/3001/src/cmd/godoc/godoc.go File src/cmd/godoc/godoc.go (right): http://codereview.appspot.com/5440100/diff/3001/src/cmd/godoc/godoc.go#newcode469 src/cmd/godoc/godoc.go:469: j := len(name) - 1 This code is a ...
13 years, 3 months ago (2011-12-06 00:01:53 UTC) #4
volker.dobler
Hello golang-dev@googlegroups.com, adg@golang.org, r@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-12-06 09:25:33 UTC) #5
volker.dobler
On 2011/12/05 23:58:28, adg wrote: > I'm having second thoughts about the numbers-only restriction. What ...
13 years, 3 months ago (2011-12-06 09:39:29 UTC) #6
volker.dobler
Hello golang-dev@googlegroups.com, adg@golang.org, r@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-12-06 22:35:11 UTC) #7
rsc
We need a suffix that is unlikely to happen in practice and does not have ...
13 years, 3 months ago (2011-12-07 18:08:00 UTC) #8
volker.dobler
On Wed, Dec 7, 2011 at 7:07 PM, Russ Cox <rsc@golang.org> wrote: > We need ...
13 years, 3 months ago (2011-12-07 21:29:24 UTC) #9
rsc
On Wed, Dec 7, 2011 at 16:29, Volker Dobler <dr.volker.dobler@gmail.com> wrote:> - ExampleType_lowercase would be ...
13 years, 3 months ago (2011-12-07 21:34:55 UTC) #10
volker.dobler
Hello golang-dev@googlegroups.com, adg@golang.org, r@google.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-12-08 19:36:12 UTC) #11
dupoxy
On 2011/12/08 19:36:12, volker.dobler wrote: > Hello mailto:golang-dev@googlegroups.com, mailto:adg@golang.org, mailto:r@google.com, mailto:rsc@golang.org > (cc: mailto:golang-dev@googlegroups.com), > ...
13 years, 3 months ago (2011-12-13 09:59:03 UTC) #12
r
http://codereview.appspot.com/5440100/diff/10001/src/cmd/godoc/godoc.go File src/cmd/godoc/godoc.go (right): http://codereview.appspot.com/5440100/diff/10001/src/cmd/godoc/godoc.go#newcode470 src/cmd/godoc/godoc.go:470: return unicode.IsLetter(r) && unicode.IsUpper(r) you don't need to test ...
13 years, 3 months ago (2011-12-14 04:52:08 UTC) #13
volker.dobler
Hello golang-dev@googlegroups.com, adg@golang.org, r@google.com, rsc@golang.org, duperray.olivier@gmail.com, r@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2011-12-14 08:33:45 UTC) #14
volker.dobler
http://codereview.appspot.com/5440100/diff/10001/src/cmd/godoc/godoc.go File src/cmd/godoc/godoc.go (right): http://codereview.appspot.com/5440100/diff/10001/src/cmd/godoc/godoc.go#newcode470 src/cmd/godoc/godoc.go:470: return unicode.IsLetter(r) && unicode.IsUpper(r) On 2011/12/14 04:52:08, r wrote: ...
13 years, 3 months ago (2011-12-14 08:34:05 UTC) #15
r
seems OK to me. leaving for others. http://codereview.appspot.com/5440100/diff/14002/src/cmd/gotest/doc.go File src/cmd/gotest/doc.go (right): http://codereview.appspot.com/5440100/diff/14002/src/cmd/gotest/doc.go#newcode45 src/cmd/gotest/doc.go:45: to the ...
13 years, 3 months ago (2011-12-15 22:54:00 UTC) #16
adg
LGTM This is much nicer now. Sorry for the delayed review.
13 years, 3 months ago (2011-12-15 22:57:51 UTC) #17
adg
13 years, 3 months ago (2011-12-15 23:02:02 UTC) #18
*** Submitted as http://code.google.com/p/go/source/detail?r=7c8a0711cc3a ***

godoc: Allow examples for methods.

An example for a method M() of type T can be written as
func ExampleT_M() { ... }.
To differentiate between multiple examples for one function, type or
method a suffix with a lowercase start may be appended to the name
of the example function, e.g. ExampleFoo_basicUsage.

Fixes issue 2465.

R=golang-dev, adg, r, rsc, duperray.olivier, r
CC=golang-dev
http://codereview.appspot.com/5440100

Committer: Andrew Gerrand <adg@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b