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

testing: document that "testdata" is idiomatic and special #14715

molivier opened this issue Mar 8, 2016 · 6 comments

testing: document that "testdata" is idiomatic and special #14715

molivier opened this issue Mar 8, 2016 · 6 comments


Copy link

@molivier molivier commented Mar 8, 2016

What version of Go are you using (go version)?
go version go1.6 linux/amd64

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

What did you do?
I read documentation at

What did you expect to see?
I expected easy to find documentation about writing a test which manipulates a file.

What did you see instead?
Instead I had difficulty discovering that I can use ".", "_", "testdata" (source). I don't know which one is the most idomatic.

@bradfitz bradfitz changed the title Documentation: Test resources testing: document that "testdata" is idiomatic and special Mar 8, 2016
@bradfitz bradfitz added this to the Go1.7 milestone Mar 8, 2016
Copy link

@bradfitz bradfitz commented Mar 8, 2016

/cc @adg @robpike for thoughts

Copy link

@cespare cespare commented Mar 8, 2016

I agree that this should be greatly improved, but for the record go help packages states (at the very end):

Directory and file names that begin with "." or "_" are ignored
by the go tool, as are directories named "testdata".

@robpike robpike self-assigned this Mar 8, 2016
Copy link

@robpike robpike commented Apr 4, 2016

The testing package has nothing to do with it. It's a property of the go tool, which does document it. But I agree a sentence in the documentation for go test would be worthwhile.

@robpike robpike removed their assignment Apr 4, 2016
@quentinmit quentinmit added the NeedsFix label May 20, 2016
Copy link

@jeffallen jeffallen commented May 24, 2016

I prepared a CL that does exactly what @robpike proposes above, changing the output of "go help test".

But rereading the original poster's request, it seems like he expected to see something in "go doc testing" (and on the web at of course).

So, @robpike take the CL if you want it. Or if you misspoke and what you wanted was a comment in the testing package instead, just ask and I'll do it instead.

Copy link

@gopherbot gopherbot commented May 24, 2016

CL mentions this issue.

@gopherbot gopherbot closed this in 2f9eeea May 24, 2016
Copy link
Contributor Author

@molivier molivier commented May 24, 2016

I must admit that I was not using go help package command. Thanks to your comments and this CL it is much clearer.

ghost referenced this issue in rqlite/rqlite Nov 25, 2016
otoolep added a commit to rqlite/rqlite that referenced this issue Nov 25, 2016
fsufitch added a commit to venicegeo/bf-ia-broker that referenced this issue Apr 4, 2017
@golang golang locked and limited conversation to collaborators May 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.