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: generate docs for test files #17509

rpetersen76 opened this issue Oct 18, 2016 · 1 comment


None yet
5 participants
Copy link

commented Oct 18, 2016

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.7 linux/amd64

What operating system and processor architecture are you using (go env)?

GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build767044606=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Trying to run godoc on a directory with test files (_test.go) does not produce documentation.

It would be great if a -test flag could be added to include generating documentation for packages that contain test files.

@quentinmit quentinmit changed the title godoc needs support for generating docs for test files cmd/doc: generate docs for test files Oct 20, 2016

@quentinmit quentinmit added this to the Go1.9Maybe milestone Oct 20, 2016

@bradfitz bradfitz modified the milestones: Go1.10, Go1.9Maybe Jun 28, 2017

@bradfitz bradfitz changed the title cmd/doc: generate docs for test files x/tools/cmd/godoc: generate docs for test files Jun 28, 2017


This comment has been minimized.

Copy link

commented Dec 4, 2017

Godoc is about showing the exported API from a package. Test files are not part of the exported API.

If the tests are so complex that they need documentation to find out how to use them, they're also often worth using from multiple tests, in which case we typically move them into separate standalone packages (not in *_test.go files), like testing/iotest and net/http/httptest. That might be the right solution for your case as well.

@rsc rsc closed this Dec 4, 2017

@golang golang locked and limited conversation to collaborators Dec 4, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.