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/cmd/guru: Guru does not detect references of embedded interface's methods #28998

Open
thakkarparth007 opened this issue Nov 29, 2018 · 2 comments

Comments

@thakkarparth007
Copy link

@thakkarparth007 thakkarparth007 commented Nov 29, 2018

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

$ go version
go version g1.11 darwin/amd64

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
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/parth/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/parth/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/2y/qxwyq2d549n48y7bmv9qpzy40000gn/T/go-build460430045=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I wrote the following code, and used VS Code's "Find all references" on Walkable interface's Walk() method, and it said "No results". VSCode uses the Guru tool for the find-all-references functionality.

package main

import "fmt"

// Walkable defines interface to be implemented by things that can Walk
type Walkable interface {
	Walk()
}

// WalkableImpl implemented the Walkable interface
type WalkableImpl struct{}

// Walk allows walking
func (w *WalkableImpl) Walk() {
	fmt.Print("Hi I'm walking")
}

// Human embeds Walkable interface
type Human struct {
	Walkable
	Name string
}

func main() {
	human := Human{
		Walkable: &WalkableImpl{},
		Name:     "Johnny",
	}
	human.Walk()
	fmt.Print("Hello world")
}

What did you expect to see?

I expect to find the human.Walk() as a result in the references list.

What did you see instead?

"No results"

@gopherbot gopherbot added this to the Unreleased milestone Nov 29, 2018
@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Nov 29, 2018

@thakkarparth007

This comment has been minimized.

Copy link
Author

@thakkarparth007 thakkarparth007 commented Mar 24, 2019

Any updates on this? A lot of code I work with has embedded structs and tracing usages of methods on those structs is impossible currently. :(

@gopherbot gopherbot added the Tools label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.