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
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@thakkarparth007
Copy link

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 agnivade added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 29, 2018
@agnivade
Copy link
Contributor

/cc @josharian

@thakkarparth007
Copy link
Author

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 This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. 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