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

x/tools/gopls: cannot navigate unsafe package from vscode thru gopls #43058

Closed
c3y28 opened this issue Dec 8, 2020 · 2 comments
Closed

x/tools/gopls: cannot navigate unsafe package from vscode thru gopls #43058

c3y28 opened this issue Dec 8, 2020 · 2 comments
Assignees
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@c3y28
Copy link

c3y28 commented Dec 8, 2020

What did you do?

edit below golang code in vscode with gopls used, try navigate Sizeof function to open unsafe.go

package main

import (
	"fmt"
	"unsafe"
)

func main() {
	account := 100
	fmt.Println(unsafe.Sizeof(account))
}

What did you expect to see?

navigate from unsafe usage to unsafe.go in vscode when using gopls. if gopls is not used, vscode works to navigate on unsafe package

What did you see instead?

fail to navigate, showing "No definition found for 'Sizeof'", open unsafe.go in the same vscode window, will see the following problem on package line
image

Build info

golang.org/x/tools/gopls v0.5.5
    golang.org/x/tools/gopls@v0.5.5 h1:YBLs2WCwxx6mBF98Y6/mDIpKhP4Dt4Dz2q6LnMRBpDw=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/google/go-cmp@v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/mod@v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
    golang.org/x/sync@v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
    golang.org/x/tools@v0.0.0-20201204180437-c46b611624b3 h1:uxH+MECLNmX/vsPe4txyeQ1LCmhdUxf7p4hjkHexg+c=
    golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
    honnef.co/go/tools@v0.0.1-2020.1.6 h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc=
    mvdan.cc/gofumpt@v0.0.0-20200927160801-5bfeb2e70dd6 h1:z+/YqapuV7VZPvBb3GYmuEJbA88M3PFUxaHilHYVCpQ=
    mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Dec 8, 2020
@gopherbot gopherbot added this to the Unreleased milestone Dec 8, 2020
@stamblerre stamblerre modified the milestones: Unreleased, gopls/unplanned Dec 8, 2020
@stamblerre stamblerre added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 8, 2020
@stamblerre
Copy link
Contributor

Thank you for the report. It looks like our use of types.Unsafe is not sufficient. Likely, the unsafe package needs to be given special treatment, much like the builtin package.

We will address this for gopls/v1.0.0, but we will not resolve this bug before February.

@gopherbot
Copy link

Change https://go.dev/cl/491036 mentions this issue: gopls/internal/lsp/source: fix crash in definitions of builtins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
No open projects
Development

No branches or pull requests

5 participants