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: vim-guru can't find description for objects if package not in GOPATH #15797

Closed
pryg-skok opened this issue May 23, 2016 · 9 comments

Comments

@pryg-skok
Copy link

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
go version go1.6.2 darwin/amd64GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/fresh/repos/gopath"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
  1. What operating system and processor architecture are you using (go env)?
    osx 10.11.4 amd64
  2. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.

I'm using guru to find object's definitions in my package. I'm running it's as it should be:
guru definition main.go:#260,#269
(which specifies bytes position of start and end of my object)

(I run it inside vim-go, but it's don't work even if I ran it by hand from command line)

  1. What did you expect to see?
    I expect to find out a position where this element was defined
  2. What did you see instead?
    guru: directory <workdir> is not beneath any of these GOROOT/GOPATH directories: $GOPATH $GOROOT
@ianlancetaylor ianlancetaylor changed the title vim-guru can't find description for objects if package not in GOPATH x/tools/cmd/guru: vim-guru can't find description for objects if package not in GOPATH May 24, 2016
@ianlancetaylor ianlancetaylor added this to the Unreleased milestone May 24, 2016
@ianlancetaylor
Copy link
Contributor

This may be working as expected.

@pryg-skok
Copy link
Author

I don't know whether it's bug or not. But it would be nice if it's working also in my project directory which may not be inside $GOPATH. Also godef was working, but it seems it's not part of golang project though.

@kostya-sh
Copy link
Contributor

kostya-sh commented May 24, 2016 via email

@pryg-skok
Copy link
Author

Why it should be?
As far as I understand $GOPATH is not necessary for building projects, but only to find dependencies and deploy.
For example how I build my project:

~/repos/tv/hls2udp $ go build -x
WORK=/var/folders/wm/f2qj2p717x39dtnzvrzchlgw0000gn/T/go-build030982323
mkdir -p $WORK/_/Users/fresh/repos/tv/hls2udp/_obj/
mkdir -p $WORK/_/Users/fresh/repos/tv/hls2udp/_obj/exe/
cd /Users/fresh/repos/tv/hls2udp
/usr/local/opt/go/libexec/pkg/tool/darwin_amd64/compile -o $WORK/_/Users/fresh/repos/tv/hls2udp.a -trimpath $WORK -p main -complete -buildid 28e11e5bc5da6ca6476e2f22b569ecc3d78ccf87 -D _/Users/fresh/repos/tv/hls2udp -I $WORK -I /Users/fresh/repos/gopath/pkg/darwin_amd64 -pack ./cache.go ./main.go ./packetizer.go ./playlist_updater.go ./sender.go ./ts.go ./utils.go
cd .
/usr/local/opt/go/libexec/pkg/tool/darwin_amd64/link -o $WORK/_/Users/fresh/repos/tv/hls2udp/_obj/exe/a.out -L $WORK -L /Users/fresh/repos/gopath/pkg/darwin_amd64 -extld=clang -buildmode=exe -buildid=28e11e5bc5da6ca6476e2f22b569ecc3d78ccf87 $WORK/_/Users/fresh/repos/tv/hls2udp.a
mv $WORK/_/Users/fresh/repos/tv/hls2udp/_obj/exe/a.out hls2udp

and my $GOPATH is: GOPATH=/Users/fresh/repos/gopath

@kostya-sh
Copy link
Contributor

You are right, projects containing only package main can be built this way.

BTW, the reported error only occurs if an identifier is defined in a different file.

@n10v
Copy link
Contributor

n10v commented Sep 11, 2016

If guru could work outside the $GOPATH, it will be very nice

@gopherbot
Copy link

CL https://golang.org/cl/30451 mentions this issue.

@n10v
Copy link
Contributor

n10v commented Oct 5, 2016

Thank you, @alandonovan!

@pryg-skok
Copy link
Author

Just updated! Works like a charm :)
Thank you very much!

@golang golang locked and limited conversation to collaborators Oct 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants