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

Standard library JSON metadata is not properly populating CompiledGoFiles #4184

Open
ellie-idb opened this issue Nov 27, 2024 · 0 comments · May be fixed by #4185
Open

Standard library JSON metadata is not properly populating CompiledGoFiles #4184

ellie-idb opened this issue Nov 27, 2024 · 0 comments · May be fixed by #4185

Comments

@ellie-idb
Copy link

What version of rules_go are you using?

0.51.0-rc1 (a985583)

What version of gazelle are you using?

0.37.0

What version of Bazel are you using?

7.4.1

Does this issue reproduce with the latest releases of all the above?

I believe so.

What operating system and processor architecture are you using?

linux/amd64

Any other potentially useful information about your toolchain?

Remote caching

What did you do?

Use gopackagesdriver with Go 1.23.3 + VS Code

What did you expect to see?

Type checking & hints to work properly for VS Code

What did you see instead?

Errors for all standard library imports, saying that the go/packages driver was unable to load the package, and that there is missing metadata. As well, inside of the gopls console, the following logs are visible:

[Info  - 11:57:02 AM] 2024/11/27 11:57:02 go/packages.Load #1
	view_id="1"
	snapshot=0
	directory=/home/ellie/work/services
	package="@@rules_go~//stdlib:internal/runtime/exithook"
	files=[]

[Info  - 11:57:02 AM] 2024/11/27 11:57:02 go/packages.Load #1
	view_id="1"
	snapshot=0
	directory=/home/ellie/work/services
	package="@@rules_go~//stdlib:net"
	files=[]

[Info  - 11:57:02 AM] 2024/11/27 11:57:02 go/packages.Load #1
	view_id="1"
	snapshot=0
	directory=/home/ellie/work/services
	package="@@//backend/models/gen:gen"
	files=[/home/ellie/work/services/backend/models/gen/cmd.go]

[censored]

[Info  - 11:57:02 AM] 2024/11/27 11:57:02 go/packages.Load #1
	view_id="1"
	snapshot=0
	directory=/home/ellie/work/services
	package="@@rules_go~//stdlib:internal/goexperiment"
	files=[]

[Info  - 11:57:02 AM] 2024/11/27 11:57:02 go/packages.Load #1
	view_id="1"
	snapshot=0
	directory=/home/ellie/work/services
	package="@@rules_go~//stdlib:internal/nettrace"
	files=[]

We've internally forked the gopackagesdriver at @devzero-inc to fix this. It turns out that it's just as easy as setting CompiledGoFiles = GoFiles for all standard library imports. I've also taken the liberty to go ahead and move the driver to using the official driver structs - as called out by @sluongng in #3962. I'm currently waiting on approval to upstream these fixes, but thought I might make an issue to track this and bring it to everyone's attention.

@ellie-idb ellie-idb linked a pull request Nov 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant