-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.
Milestone
Description
Go version
go version go1.24.11 darwin/arm64
Output of go env in your module/workspace:
GOOS='darwin'
GOPROXY='https://go-mod-proxy.byted.org,https://goproxy.cn,https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.google.cn'
.....What did you do?
below is a simple code with a function named "read", and its reference locates in the same package(main)
package main
// go run main/string_data_race_panic.go
import (
"fmt"
"reflect"
"time"
"unsafe"
)
func main() {
str := "init"
go func() {
for i := 1; i < 10000; i++ {
read(str)
}
}()
for {
str = ""
time.Sleep(10 * time.Nanosecond)
str = "/test/test/test"
time.Sleep(10 * time.Nanosecond)
}
}
func read(c string) {
s := (*reflect.StringHeader)(unsafe.Pointer(&c))
fmt.Printf("ptr: 0x%x, len: %d ", s.Data, s.Len)
fmt.Printf("fullPath: %s\n", c)
// _, _ = json.Marshal(c)
}when opened in vscode, you cannot goto the reference of function read, with gopls(server) output like this:
[Error - 17:14:56] Request textDocument/references failed.
Message: no identifier found
Code: 0 this error message also appears in these case:
[Error - 17:15:38] Request textDocument/prepareCallHierarchy failed.
Message: identifier not found
Code: 0
[Error - 17:16:09] Request textDocument/prepareTypeHierarchy failed.
Message: not a type name
Code: 0 also only enter "F12" used to trip around function definition and reference, now it is bad too.
I searched the issue list, found this issue #36917, just for your reference.
What did you see happen?
this issue may be caused by gopls v0.21.0
I used 'Go: install/update tools' to update gopls before, and I ran into this problem.
I try to reinstall the old version of gopls, and reboot vscode, the problem is solved
What did you expect to see?
go to reference works as expected!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.