Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
documentation: clarify that special directories can still be used for package paths #24732
The current documentation is a bit unfortunate when it comes to the special directories understood by the go tool.
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.
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'
What it means is that commands like
The go tool will not block you from explicitly referring to "testdata" one way or another.
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