Skip to content

x/tools/gopls: workspace symbol results appear imprecise and unstable #50016

Closed
@myitcv

Description

@myitcv

What version of Go are you using (go version)?

$ go version
go version go1.17.3 linux/arm64
$ go list -m golang.org/x/tools
golang.org/x/tools v0.1.9-0.20211203185511-c882a49eac7c
$ go list -m golang.org/x/tools/gopls
golang.org/x/tools/gopls v0.0.0-20211203185511-c882a49eac7c

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN="/home/myitcv/dev/cuelang/bin"
GOCACHE="/home/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/myitcv/gostuff/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_arm64"
GOVCS=""
GOVERSION="go1.17.3"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/dev/cuelang/cue/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build251903034=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  • Start with a fresh clone of the https://github.com/cue-lang/cue repository. For reference, I was working against 28b42576ce831209f4dd796d3515f16f784ba570.
  • Initiate a workspace symbol search using the query cue.Value
  • Observe the results

What did you expect to see?

Stable results, with cuelang.org/go/cue.Value as the result with the highest score

What did you see instead?

Variously unstable results (highest score at the bottom, fzf-UX):

...
  cuelang.org/go/internal/core/adt.ValueReference
  cuelang.org/go/internal/core/adt.ValueError
  cuelang.org/go/cue.ValueAttr
  cuelang.org/go/internal/core/subsume.Value
  cuelang.org/go/internal/types.Value
  cuelang.org/go/encoding/openapi.value
  cuelang.org/go/internal/encoding.valueToFile
  cuelang.org/go/cue.valueError
  cuelang.org/go/cue.valueSorter
  cuelang.org/go/pkg/list.valueSorter
  cuelang.org/go/cue.valueScope
  cuelang.org/go/cue.Value
> cuelang.org/go/cue.valueToSel
...
  cuelang.org/go/internal/core/adt.Value
  cuelang.org/go/internal/types.Value
  cuelang.org/go/cue.valueSorter
  cuelang.org/go/internal/core/adt.ValueError
  cuelang.org/go/internal/core/adt.valueError
  cuelang.org/go/cue.valueScope
  cuelang.org/go/cue.Value
  cuelang.org/go/cue.valueError
  cuelang.org/go/encoding/openapi.value
  cuelang.org/go/internal/encoding.valueToFile
  cuelang.org/go/cue.valueToSel
  cuelang.org/go/internal/core/subsume.Value
  cuelang.org/go/cue.ValueAttr
  cuelang.org/go/internal/core/adt.ValueClause
  cuelang.org/go/internal/core/adt.ValueReference
  cuelang.org/go/internal/core/export.Value
  cuelang.org/go/encoding/protobuf/pbinternal.ValueType
> cuelang.org/go/pkg/list.valueSorter

Logfile from a session in which I ran three such queries:

gopls.log


cc @findleyr

FYI @leitzler

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions