-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: clarify that special directories can still be used for package paths #24732
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
Comments
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. |
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
would behave the same as the '.code.go' |
I'd agree with @russoj88. Can someone define what it really means that |
I also expect |
What it means is that commands like The go tool will not block you from explicitly referring to "testdata" one way or another. |
Under
If my 1st assumption is correct (directories that have as suffix -- It is correct to place .go code under testdata folders? e.g. fixtures. If so, the behaviour I would expect is go build command to ignore these folders. |
Only directories that are literally named It's fine to put Go files in a |
The behavior was explained in #24732 (comment). Do you think it would be helpful to put that information in |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
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
https://golang.org/cmd/go/#hdr-Package_lists
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.
The text was updated successfully, but these errors were encountered: