-
Notifications
You must be signed in to change notification settings - Fork 799
No packages found for open file #2715
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
This looks related to https://go.dev/issue/57081 Can you try installing gopls at master? It may not get confused about the changed case. |
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.) |
I just had this exact scenario happen to me, created a file, edited the case and now I get this warning and restarting my IDE doesn't make it go away. So this seems to still be an active issue I guess? |
In my case simple go 1.22.1 |
Hey, I got the same issue “No package found for open file ...” when I copied my project_dir/cmd/module to module2 in VScode for creating a template for a similar module. After renaming module-filename to module-filename.go, everything is fine. |
For others who come along, this error was related to the use of build flags. After some time and an IDE reload, I got a more verbose message -
I was in fact using build flags and this is exactly the reason. The file is omitted based on these flags by default. |
After changing the file name from DaemonSet.go to daemonSet.go, the issue still persisted. I deleted the go.mod and go.sum files, reinitialized with |
Thanks for the suggestion, this cleared up the same issue for me. I can reproduce the issue by creating a new .go file containing a capital letter, pasting package main with a helloWorld function, then I change the filename to be all lowercase. Error message (TestCamelCase.go has been renamed testcamelcase.go):
gopls (server) output
Windows 10 |
Issue Summary:I encountered this issue on a Unix-based OS (specifically macOS), and it only occurred with one file in the project rather than the whole project. Based on my observations, this issue seems related to case-sensitive file systems, which are typical on Unix-based operating systems. Solution:
This resolved the issue for me. |
I have tried all the methods you mentioned, but none of them worked. I upgraded the version of go from 1.22 to 1.23, and the problem was solved on vscode |
I have encountered same issue and also on macOS. Same solution to me, it also stated (not every time, this was the very confusing part, sometimes it showed the message sometimes it didn't: "Found case-sensitive problem Repository.go and repository.go" since I renamed the file after creation). But the solution stated here worked to me also. |
For someone still struggling about this, mine was just forgetting |
So if none of comments helped - in my case module in my go.mod file was named "mod" instead of my project name. Try renaming it like this: |
update go from 1.22 to go1.23.4 resolved my problem |
In my case, I actually had a function that was named very similar to the file. The package name was completely unrelated. Weird error. My file name was something like myFunc.go and my function was MyFunc(). I renamed the function and the error went away. Go 1.21 |
Similar error when using Mage. |
Just ran into this because I accidently used The rename/quit/rename/quit trick cleared it. Before that, I tried rename and rename back without quitting in between, which was insufficient. The issue should be re-opened, imho. |
I'm getting this issue with a package that is in my go modules.
What I don't understand is what does it mean about my My build of gopls is installed using Edit: just thought I should add I have no custom gopls config setting tags or anything |
Uh oh!
There was an error while loading. Please reload this page.
1、question prompt:
No packages found for open file E:\data\huisi180\project\hszl\api\model\entity\crm\CustomerStatus.go: .
If this file contains build tags, try adding "-tags=" to your gopls "buildFlags" configuration (see (https://github.com/golang/tools/blob/master/gopls/doc/settings.md#buildflags-string).
Otherwise, see the troubleshooting guidelines for help investigating (https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md).
2、
go version go1.20.2 windows/amd64
VS Code 1.77.0
golang.org/x/tools/gopls v0.11.0
3、Problem Description
Create a new file named CustomerStatus.go, change the file name to customerStatus.go, the above error occurs
The text was updated successfully, but these errors were encountered: