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: Can't find references if two packages have the same top-level name #38094

Open
coreyog opened this issue Mar 26, 2020 · 1 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.
Milestone

Comments

@coreyog
Copy link

coreyog commented Mar 26, 2020

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

$ go version
go version go1.14.1 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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/cogburn/Library/Caches/go-build"
GOENV="/Users/cogburn/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/cogburn/src/goprojects"
GOPRIVATE=""
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=""
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/36/t5tp3n552gj71zsh8949yb6m0000gn/T/go-build983642327=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

The structure of our API looks like this:

handlers
    /a
    /b
    /c
service
    /a
    /b
    /c

Inside handlers is where we register routes, validate the payload, and generally do all the HTTP stuff. Then handlers calls a function in the corresponding service package, e.g. handlers/a will import and call functions in service/a. Here we do the business logic.

If I'm inside the handlers/a namespace and I "Find All References" in vscode on a function defined in service/a then guru only finds the references in handlers/a. I believe guru gets confused on which namespace "a" is in the code.

== handlers/a/a.go ==

package a

import (
  "service/a"
)

func DoSomething() {
  a.DoIt() // "Find All References" on the DoIt function only searches handlers/a and not service/a
}

What did you expect to see?

I expect to see the references from the imported package.

What did you see instead?

A list of references containing only the usages in the current package.

@gopherbot gopherbot added this to the Unreleased milestone Mar 26, 2020
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Mar 26, 2020
@andybons
Copy link
Member

@alandonovan @josharian

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 26, 2020
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