Skip to content

Wrong inlay hints of unsafe.Sizeof(AType{}) #3146

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

Closed
wenhao-huu opened this issue Jan 22, 2024 · 5 comments
Closed

Wrong inlay hints of unsafe.Sizeof(AType{}) #3146

wenhao-huu opened this issue Jan 22, 2024 · 5 comments

Comments

@wenhao-huu
Copy link

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • <go version go1.19.1 linux/amd64>
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • <golang.org/x/tools/gopls v0.14.2>
  • Check your installed extensions to get the version of the VS Code Go extension
    • <v0.40.1>

Describe the bug

Inlay hint shows wrong value of unsafe.Sizeof(AType{}). And it only occurs when AType has an auto padding at the end.

Steps to reproduce the behavior:

See the screenshot.

Screenshots or recordings

image

@gopherbot gopherbot added this to the Untriaged milestone Jan 22, 2024
@wenhao-huu wenhao-huu changed the title Wrong inlay hints of unsafe.Sizeof constants Wrong inlay hints of unsafe.Sizeof(AType{}) Jan 22, 2024
@wenhao-huu
Copy link
Author

wenhao-huu commented Jan 22, 2024

I think it should blame to gopls:
image

@hyangah
Copy link
Contributor

hyangah commented Jan 23, 2024

@HwHgoo thanks for the report. Can you please try the gopls with go1.22rc1?
I think this is fixed in go1.22. (golang/go#61035)

@wenhao-huu
Copy link
Author

@HwHgoo thanks for the report. Can you please try the gopls with go1.22rc1? I think this is fixed in go1.22. (golang/go#61035)

version
image

It seems go1.22rc1 doesn't fix it as expected. I don't know if I'm doing right: I build the go1.22rc and override the path of go which originally is /usr/bin/go by simply doing export PATH=$PATH_TO_GO1.22rc1:$PATH.

@hyangah
Copy link
Contributor

hyangah commented Jan 23, 2024

@HwHgoo Can you check what version of go was used to build the gopls?

gopls -v version

Or, use the Go explorer UI to inspect the tools versions.
Screenshot 2024-01-23 at 10 25 07 AM

If it's not built with go1.22rc1, run "Go: Install/Update Tools".

@wenhao-huu
Copy link
Author

Yes it's fixed.
image
But it's confusing that even I do export PATH=$PATH_TO_GO122rc1:$PATH, /usr/bin/go is used when I run go install golang.org/x/tools/gopls@latest.
Thank you for replies.

@golang golang locked and limited conversation to collaborators Jan 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants