Skip to content
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

Cannot Navigate to functions / symbols from _windows.go on MacOS #3421

Closed
wayneforrest opened this issue Jun 8, 2024 · 8 comments
Closed
Labels
gopls gopls related issues
Milestone

Comments

@wayneforrest
Copy link

Type: Bug

On MacOS, create a windows specific file i.e. main_windows.go
and then navigate to functions/symbols that are not OS specific.

I observed the following in the console which might be related.

ERR getting file for InlayHint: no package metadata for file file:///Users/user_name/Documents/Projects/project_name/project_name-lib/main_windows.go: Error: getting file for InlayHint: no package metadata for file file:///Users/user_name/Documents/Projects/project_name/project_name-lib/main_windows.go
  at handleResponse (/Users/user_name/.vscode/extensions/golang.go-0.41.4/dist/goMain.js:8606:40)
  at handleMessage (/Users/user_name/.vscode/extensions/golang.go-0.41.4/dist/goMain.js:8416:11)
  at processMessageQueue (/Users/user_name/.vscode/extensions/golang.go-0.41.4/dist/goMain.js:8431:13)
  at Immediate.<anonymous> (/Users/user_name/.vscode/extensions/golang.go-0.41.4/dist/goMain.js:8407:11)
  at process.processImmediate (node:internal/timers:478:21)

Extension version: 0.41.4
VS Code version: Code 1.90.0 (89de5a8d4d6205e5b11647eb6a74844ca23d2573, 2024-06-04T19:34:48.028Z)
OS version: Darwin arm64 23.5.0
Modes:

System Info
Item Value
CPUs Apple M1 Max (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 1, 1, 2
Memory (System) 64.00GB (26.91GB free)
Process Argv --crash-reporter-id 6ae0718c-b842-40d4-b26c-660ef4c1fcf9
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
showvideot:31016892
chatpanelc:31048052
dsvsc021:30996838
01bff139:31013167
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
pythonprt:31056678
dwnewjupyter:31046869
26j00206:31048877

@gopherbot gopherbot added this to the Untriaged milestone Jun 8, 2024
@findleyr
Copy link
Contributor

Hi, what is your gopls version? This should have been fixed in gopls@v0.15.x.

Please run gopls -v version and share the output.

@findleyr findleyr added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 10, 2024
@wayneforrest
Copy link
Author

Hi @findleyr here is my versions:

golang.org/x/tools/gopls v0.15.3 golang.org/x/tools/gopls@v0.15.3 h1:zbdOidFrPTc8Bx0YrN5QKgJ0zCjyGi0L27sKQ/bDG5o= github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/google/go-cmp@v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y= golang.org/x/mod@v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= golang.org/x/sync@v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/telemetry@v0.0.0-20240209200032-7b892fcb8a78 h1:vcVnuftN4J4UKLRcgetjzfU9FjjgXUUYUc3JhFplgV4= golang.org/x/text@v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/tools@v0.18.1-0.20240412183611-d92ae0781217 h1:uH9jJYgeLCvblH0S+03kFO0qUDxRkbLRLFiKVVDl7ak= golang.org/x/vuln@v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= honnef.co/go/tools@v0.4.6 h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8= mvdan.cc/gofumpt@v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo= mvdan.cc/xurls/v2@v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=

@findleyr findleyr removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 10, 2024
@findleyr
Copy link
Contributor

Thanks. This doesn't reproduce for me. When I create a main_windows.go, gopls indeed works as expected -- for example I can jump to definition.

Can you share exact steps to reproduce? Are you just creating a main_windows.go file in an empty workspace folder?

@wayneforrest
Copy link
Author

@findleyr thank you for assisting. I will only be able to try this later tonight. I will then experiment and see what is going on.

I also have a main_darwin.go file together with a main_windows.go file, and both then reach out to normal go files.
I can navigate from the darwin file, but not from my windows file. (Also this is done from MacOS). Perhaps some environment vars are at play here?

But I will try again tonight, and get back with more details (it might just be this project).

@wayneforrest
Copy link
Author

wayneforrest commented Jun 11, 2024

Hi @findleyr, I have managed to reproduce the problem. (well I think so).

1: create two files. main_windows.go and main_darwin.go, both having func main() defined in them.
2: create a package called callme, and in it a func CallMe() { fmt.Println("called me") }
3: in both files add a import "C" line
4: call the function callme.CallMe() from within the main function.

As soon as I add the import "C", I am unable to navigate, from the main_windows.go file, to the function definition of CallMe(), by using the command key and the mouse:CMD+Mouse+Click.

image

@suzmue
Copy link
Contributor

suzmue commented Jun 11, 2024

@wayneforrest Thanks for the repro, I was able to reproduce the issue locally when using cgo as well.

@findleyr this comment from the zero-config issue seems to refer to this same problem.

@findleyr
Copy link
Contributor

This is indeed a known issue. Setting GOOS or GOARCH do a cross-platform value implies CGO_ENABLED=0 (because we have no C compiler).

We could do better here, but that is covered under #35721 among other issues. Closing as a dupe.

(Since this was just raised again, I'm going to experiment with using go/types.Config.FakeImportC to work around this issue).

@findleyr
Copy link
Contributor

This is actually a better dupe of golang/go#65758.

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls gopls related issues
Projects
None yet
Development

No branches or pull requests

4 participants