Skip to content

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

Closed

Description

@molivier

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.

Activity

  1. changed the title [-]Documentation: Test resources[/-] [+]testing: document that "testdata" is idiomatic and special[/+] on Mar 8, 2016
  2. added this to the Go1.7 milestone on Mar 8, 2016
  3. bradfitz commented on Mar 8, 2016

    @bradfitz
    Contributor

    /cc @adg @robpike for thoughts

  4. cespare commented on Mar 8, 2016

    @cespare
    Contributor

    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".

  5. self-assigned this
    on Mar 8, 2016
  6. robpike commented on Apr 4, 2016

    @robpike
    Contributor

    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.

  7. removed their assignment
    on Apr 4, 2016
  8. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on May 20, 2016
  9. jeffallen commented on May 24, 2016

    @jeffallen
    Contributor

    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.

  10. gopherbot commented on May 24, 2016

    @gopherbot
    Contributor

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

  11. molivier commented on May 24, 2016

    @molivier
    ContributorAuthor

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

  12. ghost added a commit that references this issue on Nov 25, 2016
  13. locked and limited conversation to collaborators on May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions