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: no results for implementations #36219

Closed
DBreitigan opened this issue Dec 19, 2019 · 4 comments
Closed

x/tools/gopls: no results for implementations #36219

DBreitigan opened this issue Dec 19, 2019 · 4 comments
Labels
FrozenDueToAge 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

@DBreitigan
Copy link

What did you do?

when trying to run "find implementation" of fooInterface's method test(int) int, It give me an error "no implementation found".

package main

import (
	"fmt"
)

type fooInterface interface {
	test(int) int
}

type fooStruct struct {
}

func main() {
	f := fooStruct{}

	fmt.Println(f.test(5))
	fmt.Println("Hello, playground")
}

func (f fooStruct) test(i int) int {
	return i
}

What did you expect to see?

I expect to be taken to implementations of test(int) int, in this case, fooStruct's implementation

What did you see instead?

An error:

[Error  - 9:01:34 AM] Request textDocument/implementation failed.
  Message: no type info object for identifier
  Code: 0 

Build info

golang.org/x/tools/gopls 0.2.2
    golang.org/x/tools/gopls@v0.2.2 h1:ujGisyytgY1VGcmd66wIJ9+wVAfmodXj6daHM43HRXk=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20191206201009-952e2c076240 h1:metzFnqcC0vUPmZX4El8bICiQU9hieZ3L9dXAitxVXQ=
    golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
    honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=

Go info

go version go1.13 darwin/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/dbreitigan/go/bin"
GOCACHE="/Users/dbreitigan/Library/Caches/go-build"
GOENV="/Users/dbreitigan/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY="github.com/sendgrid"
GONOSUMDB="github.com/sendgrid"
GOOS="darwin"
GOPATH="/Users/dbreitigan/go"
GOPRIVATE="github.com/sendgrid"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/dbreitigan/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 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bq/mj22kv3d3933j2tqsl4c5z600000gp/T/go-build005566294=/tmp/go-build -gno-record-gcc-switches -fno-common"
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Dec 19, 2019
@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@stamblerre stamblerre changed the title gopls: Find an interface's method implementations returns nothing x/tools/gopls: no results for implementations Dec 19, 2019
@gopherbot gopherbot added this to the Unreleased milestone Dec 19, 2019
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Dec 19, 2019
@stamblerre
Copy link
Contributor

I believe that the support for implementations is incomplete in gopls v0.2.2. The next tagged version will have improved support.

Can you try reproducing the issue at master? You can download master by running GO111MODULE=on go get golang.org/x/tools/gopls@master golang.org/x/tools@master.

@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Dec 19, 2019
@DBreitigan
Copy link
Author

@stamblerre Yes, you are correct. After updating to master, find implementation is properly working. Thanks for your help!

@stamblerre
Copy link
Contributor

Great, thank you for confirming!

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.4.0 Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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