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

documentation: clarify that special directories can still be used for package paths #24732

Open
dlsniper opened this issue Apr 6, 2018 · 2 comments

Comments

@dlsniper
Copy link
Contributor

commented Apr 6, 2018

Hi,

The current documentation is a bit unfortunate when it comes to the special directories understood by the go tool.

https://golang.org/cmd/go/#hdr-Test_packages

The go tool will ignore a directory named "testdata", making it available to hold ancillary data needed by the tests.

https://golang.org/cmd/go/#hdr-Package_lists

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

However, those directories can currently be used just as well for compiling. Unfortunately, I don't have a better wording yet that would describe that only certain operations will behave in this special mode for these special rules/directories.

This comes up often enough as tooling can suggest completion symbols from these directories then users can interpret this as a problem with the tooling rather than special cases in certain go tool usages.

Thank you.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Apr 18, 2018

Sorry, I'm not sure what you are suggesting. What do you mean when you say "those directories can currently be used just as well for compiling?" Whatever it means, is it an important enough use to be called out in the documentation? Thanks.

@russoj88

This comment has been minimized.

Copy link

commented Apr 18, 2018

I thought the directory 'testdata' (and sub directories) should only contain test fixtures. My understanding from the docs was that anything placed in 'testdata' would be ignored/undefined during compile.

If I put code in a file called '.code.go', and try to reference it, it results in a compile error (undefined). I can import code from a directory named '.pkg' however. The behavior is at a minimum inconsistent.

I thought that

Directory and file names that begin with "." or "_"

would behave the same as the '.code.go'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.