Skip to content

x/tools/gopls: gopls implementation result does not include all types in vendor directory #56169

Closed
@x-yuri

Description

@x-yuri

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.
    Build info
    ----------
    golang.org/x/tools/gopls v0.9.5
        golang.org/x/tools/gopls@(devel)
        github.com/BurntSushi/toml@v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
        github.com/google/go-cmp@v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
        github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
        golang.org/x/exp@v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
        golang.org/x/exp/typeparams@v0.0.0-20220722155223-a9213eeb770e h1:7Xs2YCOpMlNqSQSmrrnhlzBXIE/bpMecZplbLePTJvE=
        golang.org/x/mod@v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
        golang.org/x/sync@v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
        golang.org/x/sys@v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
        golang.org/x/text@v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
        golang.org/x/tools@v0.1.13-0.20220908144252-ce397412b6a4 h1:glzimF7qHZuKVEiMbE7UqBu44MyTjt5u6j3Jz+rfMRM=
        golang.org/x/vuln@v0.0.0-20220901221904-62b0186a1058 h1:YnB27EXBD8XxB0JcaOeluuvhF2kS4DrH0k+lpopG2xc=
        honnef.co/go/tools@v0.3.2 h1:ytYb4rOqyp1TSa2EPvNVwtPQJctSELKaMyLfqNP4+34=
        mvdan.cc/gofumpt@v0.3.1 h1:avhhrOmv0IuvQVK7fvwV91oFSGAk5/6Po8GXTzICeu8=
        mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
    go: go1.19.1
    
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    1.71.2
    74b1f979648cc44d385a2286793c226e611f59e7
    x64
    
  • Check your installed extensions to get the version of the VS Code Go extension
    • v0.35.2
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
    Checking configured tools....
    GOBIN: undefined
    toolsGopath: 
    gopath: /home/yuri/go
    GOROOT: /usr/lib/go
    PATH: /home/yuri/perl5/bin:/home/yuri/bin:/home/yuri/Dropbox/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    
        go: /usr/bin/go: go version go1.19.1 linux/amd64
    
        gotests:    not installed
        gomodifytags:   not installed
        impl:   not installed
        goplay: not installed
        dlv:    /usr/bin/dlv    (version: (devel) built with go: go1.19)
        staticcheck:    /usr/bin/staticcheck    (version: (devel) built with go: go1.18.5)
        gopls:  /usr/bin/gopls  (version: (devel) built with go: go1.19.1)
    
    go env
    Workspace Folder (docker): /home/yuri/go/src/github.com/docker/docker
        GO111MODULE=""
        GOARCH="amd64"
        GOBIN=""
        GOCACHE="/home/yuri/.cache/go-build"
        GOENV="/home/yuri/.config/go/env"
        GOEXE=""
        GOEXPERIMENT=""
        GOFLAGS=""
        GOHOSTARCH="amd64"
        GOHOSTOS="linux"
        GOINSECURE=""
        GOMODCACHE="/home/yuri/go/pkg/mod"
        GONOPROXY=""
        GONOSUMDB=""
        GOOS="linux"
        GOPATH="/home/yuri/go"
        GOPRIVATE=""
        GOPROXY="https://proxy.golang.org,direct"
        GOROOT="/usr/lib/go"
        GOSUMDB="sum.golang.org"
        GOTMPDIR=""
        GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
        GOVCS=""
        GOVERSION="go1.19.1"
        GCCGO="gccgo"
        GOAMD64="v1"
        AR="ar"
        CC="gcc"
        CXX="g++"
        CGO_ENABLED="1"
        GOMOD="/dev/null"
        GOWORK=""
        CGO_CFLAGS="-g -O2"
        CGO_CPPFLAGS=""
        CGO_CXXFLAGS="-g -O2"
        CGO_FFLAGS="-g -O2"
        CGO_LDFLAGS="-g -O2"
        PKG_CONFIG="pkg-config"
        GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1841263837=/tmp/go-build -gno-record-gcc-switches"
    

Share the Go related settings you have added/edited

I didn't change any settings.

Describe the bug

I trying to examine the moby project, and the extension seems to ignore the vendor dir. Possibly because there's no go.mod at the root of the repository. E.g. it can't find the implementation of p.repo.Blobs, that is located here. As long as I need to navigate within the main module it seems to work fine.

Steps to reproduce the behavior:

  1. Clone https://github.com/moby/moby to ~/go/src/github.com/docker/docker.
  2. Open the directory in code, then distribution/pull_v2.go (line 903).
  3. Right click on Blobs, choose "Go to Implementations".

You'll see only some mock implementations from distribution/push_v2_test.go.

Screenshots or recordings

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions