-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/go/packages: not handling non-known files #28766
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
Why would you expect those files to be included? They are not part of a Go package, and If you need to find a file on disk next to a Go file, it's likely easiest to take the Go file's directory and see if the filename you're after exists there. |
Because semantically, you often can only test via loading non-source files. |
Sorry, I don't understand what you mean. Do you mean that non-source files in a package's directory can be required for the package's tests to succeed? That's certainly reasonable, and it's why |
@abergmeier You can put these files in the
Then you load them in your tests by name or using something like |
Can you be a bit more specific? |
Hi, As far as go/packages goes, this is working as intended: The file= query to go/packages only works for Go files. We might be able to help you fix your problem, but I think we need some more information on what you're trying to do: What do you mean by fetching your module? Why do you need the absolute path of testdata? I'll assign this bug back to you for now. Please assign it back once you've responded |
No updates for almost 3 years, assuming this is no longer needed. |
What version of Go are you using (
go version
)?1.11.1
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Trying to use go/packages, we face the problem, that all this works fine - unless we need non-known files (these are currently not mapped in .e.g
go list
). As such, searching forfile=myfile.go
works fine butfile=whatever.yml
does not. Also,whatever.yml
is not added to theOtherFiles
slice, sincego list
only works with "known" file extensions (e.g.foo.h
).As a result, "non-known" files can currently no be found using
go/packages
when using the goList driver.What did you expect to see?
It would be great if
go list
would also expose "non-known" files and thus be able to search them via pattern ingo/packages
.otherfile=whatever.yml
would be ok as a pattern, too.The text was updated successfully, but these errors were encountered: