Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/godoc: ExampleABC functions not matching a suffix rule are not displayed #10494

Open
alandonovan opened this issue Apr 17, 2015 · 1 comment
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@alandonovan
Copy link
Contributor

When viewing examples in godoc, a function called ExampleABC that doesn't match any of the suffix patterns described here

http://golang.org/pkg/testing/#hdr-Examples

is silently excluded. I would have expected it to be associated with the package.

The -ex flag makes no difference.

You can see an example in the x/tools repo, if you sync to 9c57c19 and look at golang.org/x/tools/go/loader. The follow-up change, 41d9a0e, renames the examples to make them visible.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jun 3, 2015
@rsc rsc modified the milestones: Unplanned, Go1.6 Jan 13, 2016
@agnivade
Copy link
Contributor

agnivade commented Feb 4, 2018

This seems to be intended functionality -

name := stripExampleSuffix(e.Name)
if name == "" || globals[name] {
	examples = append(examples, e)
} else if c.Verbose {
	log.Printf("skipping example 'Example%s' because '%s' is not a known function or type", e.Name, e.Name)
}

https://github.com/golang/tools/blob/master/godoc/server.go#L434

It strips the suffix and checks whether it matches with a global name or not. Do we want to remove it ?

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants