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

Closed
molivier opened this issue Mar 8, 2016 · 6 comments
Closed

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

molivier opened this issue Mar 8, 2016 · 6 comments
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@molivier
Copy link
Contributor

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)?
GOOS="linux"
GOARCH="amd64"

What did you do?
I read documentation at https://golang.org/pkg/testing/.

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
@bradfitz
Copy link
Contributor

bradfitz commented Mar 8, 2016

/cc @adg @robpike for thoughts

@cespare
Copy link
Contributor

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
@robpike
Copy link
Contributor

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 The path to resolution is known, but the work has not been done. label May 20, 2016
@jeffallen
Copy link
Contributor

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 golang.org/pkg/testing 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.

@gopherbot
Copy link

CL https://golang.org/cl/23353 mentions this issue.

@molivier
Copy link
Contributor Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants