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
x/tools/gopls: confusion over case of file name on macOS #61293
Comments
I recommend following the naming conventions for Go files. Use lowercase letters and, if needed, separate words with underscores. For example, you can rename your file to const_connection_type.go or something similar. |
|
Could you give more detail on what exactly you did? Did you create the file through your editor (which one?) or some other way? What did you do in your editor that triggered the codeAction request for the wrong name? Most editors will refuse to load a file with the wrong name: they will correct the spelling to match what appears in the directory. (Some macOS file systems are configured to use case-sensitive matching, like Linux. I assume you haven't enabled this setting, but for completeness I should ask.) If you're comfortable, please share a more complete log of the editor-to-gopls session. Thanks. |
I create file and modify file's name in vscode(Mac OS). Maybe when I modify file's name, this problem exist. this is another example of this problem (I modified file name from device_HeartBeat.go to device_heartbeat.go) [Info - 오전 11:25:26] 2023/07/14 11:25:26 gopathwalk: scanned /Users/tu/.asdf/installs/golang/1.18/packages/pkg/mod in 12.689434ms [Error - 오전 11:48:00] Request textDocument/codeAction failed. [Error - 오전 11:48:00] Request textDocument/inlayHint failed. |
if you need more information, please reply. i really wanna solve this problem.... @adonovan |
Here is a repro:
So far ok.
See we get the duplicate file on case-insensitive fs error.
See VS Code still sends requests with After this state, even when we rename The only way to recover is to reload the VS Code ( This looks like a VS Code's (or VS Code lsp client's) bug IMO. |
Ok, a bit of digging in vscode issue tracker led me to conclude, this is a known bug in vscode. As discussed in Some more contexts
|
Thank you for interesting in this @hyangah
After reload , There is same problem...
Thank you for your comment. if i get more information or solution working to me, i will comment again... |
@TaeukSun Unfortunately, the problem is inside vscode. I am afraid building any workaround in the gopls side will add significant complexity and may cause other kinds of bugs. I think it's best to avoid renaming files and directories in this way on mac. EDIT: I think you will need to close the editor tab of the renamed file before reloading, and reload the vscode window, to make this problem go away. @golang/tools-team Independent of this issue, I think the error message needs improvement. |
@hyangah Thank you for your comment. and I understand that this problem is dependent on vscode. And this work for me. thank you!!!
|
$ go version
go version go1.18 darwin/amd64
What did you expect to see?
go/packages.Load for constConnectionType.go
What did you see instead?
Problem:
This file is within module ".", which is not included in your workspace.
To fix this problem, you can add a go.work file that uses this directory.
See the documentation for more information on setting up your workspace:
https://github.com/golang/tools/blob/master/gopls/doc/workspace.md.go list
gopls Print
[Error - 오후 5:06:20] Request textDocument/codeAction failed.
Message: no package metadata for file file:///Users/tu/g***/g***/models/g***/ConstConnectionType.go
Code: 0
First case is Wrong.. My file name start with 'c' not 'C'
if i change filename, it works.
ex)
constConnectionType.go -> constConnectionType_1.go works
but constConnectionType.go -> ConstConnectionType.go not works
anyone know about this issue?
The text was updated successfully, but these errors were encountered: