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: missing completion of current module packages #67528

Open
arcenik opened this issue May 15, 2024 · 2 comments
Open

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

arcenik opened this issue May 15, 2024 · 2 comments
Labels
gopls/completion Issues related to auto-completion in gopls. gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@arcenik
Copy link

arcenik commented May 15, 2024

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 findleyr transferred this issue from golang/vscode-go May 20, 2024
@findleyr findleyr changed the title Completion of current module packages does not work x/tools/gopls: missin completion of current module packages May 20, 2024
@findleyr findleyr changed the title x/tools/gopls: missin completion of current module packages x/tools/gopls: missing completion of current module packages May 20, 2024
@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 May 20, 2024
@gopherbot gopherbot added this to the Unreleased milestone May 20, 2024
@findleyr
Copy link
Contributor

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 findleyr modified the milestones: Unreleased, gopls/v0.16.0 May 20, 2024
@findleyr findleyr added the gopls/completion Issues related to auto-completion in gopls. label May 20, 2024
@findleyr
Copy link
Contributor

findleyr commented Jun 5, 2024

I believe this may be related to #67289.

@findleyr findleyr modified the milestones: gopls/v0.16.0, gopls/v0.17.0 Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/completion Issues related to auto-completion in gopls. gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants