golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
121.11k stars 17.37k forks source link

x/tools/gopls: missing completion of current module packages #67528

Open arcenik opened 1 month ago

arcenik commented 1 month ago

When I try to add an import for a package within the current module, I got the following error

image

Despite example.com/bank is the module name as define in the go.mod file

image

nb: this comes from: https://github.com/mschwarzmueller/go-complete-guide-resources/tree/main/code/03-working-with-packages/04-third-party-packages

On the video from Udemy, we can see the expected completion list: image

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.22.3 linux/amd64 * Run `gopls -v version` to get version of Gopls from _the VS Code integrated terminal_. - golang.org/x/tools/gopls (devel) * Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - Code - OSS 1.90.0 * Check your installed extensions to get the version of the VS Code Go extension - v0.41.4 * Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > `Go: Locate Configured Go Tools` command. - # Tools Configuration ## Environment GOBIN: undefined toolsGopath: gopath: /home/fs/go GOROOT: /usr/lib/go PATH: /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl ## Tools go: /usr/bin/go: go version go1.22.3 linux/amd64 gopls: /home/fs/go/bin/gopls (version: v0.15.3 built with go: go1.22.3) gotests: not installed gomodifytags: not installed impl: not installed goplay: not installed dlv: not installed staticcheck: /usr/bin/staticcheck (version: (devel) built with go: go1.22.0) ## Go env Workspace Folder (udemy-aws-saa): /home/fs/LEARN/udemy-aws-saa GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/home/fs/.cache/go-build' GOENV='/home/fs/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/fs/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/fs/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/lib/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.22.3' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/dev/null' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3950534641=/tmp/go-build -gno-record-gcc-switches' Workspace Folder (udemy-go-complete-guide): /home/fs/LEARN/udemy-go-complete-guide GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/home/fs/.cache/go-build' GOENV='/home/fs/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/fs/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/fs/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/lib/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.22.3' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/dev/null' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3654690374=/tmp/go-build -gno-record-gcc-switches' Workspace Folder (go-complete-guide-resources): /home/fs/tmp/go-complete-guide-resources GO111MODULE='' GOARCH='amd64' GOBIN='' GOCACHE='/home/fs/.cache/go-build' GOENV='/home/fs/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/fs/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='linux' GOPATH='/home/fs/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/lib/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.22.3' GCCGO='gccgo' GOAMD64='v1' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='1' GOMOD='/dev/null' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3652590404=/tmp/go-build -gno-record-gcc-switches'

Share the Go related settings you have added/edited

Nothing special

Steps to reproduce the behavior:

Clone the repo and play with the file https://github.com/mschwarzmueller/go-complete-guide-resources/blob/main/code/03-working-with-packages/04-third-party-packages/bank.go#L6

findleyr commented 1 month ago

Thank you for reporting. Transferred to the go issue tracker since this must be a gopls issue.

Assigning to the gopls@v0.16.0 milestone for further triage (though it may slip to v0.17.0).

findleyr commented 4 weeks ago

I believe this may be related to #67289.