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

godef needs GOPATH set but this is not needed by Go 1.9 onwards #73

Open
duncanharris opened this issue Oct 19, 2017 · 3 comments
Open

Comments

@duncanharris
Copy link

I have Go installed to a non-standard path. With Go 1.9 all you need is the go executable on the path and then Go figures everything out from there. However godef is not so clever and wants GOROOT to be set.

The following shows my Go environment with godef not working and then me setting GOROOT to get it working.

$ ls -l `which go`
lrwxrwxrwx 1 root root 29 Sep 12 11:01 /usr/bin/go -> /home/duncan/.go/go1.9/bin/go
$ set | fgrep GO
GOPATH=/home/duncan/.local
$ go version
go version go1.9 linux/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/duncan/.local"
GORACE=""
GOROOT="/home/duncan/.go/go1.9"
GOTOOLDIR="/home/duncan/.go/go1.9/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build177033922=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
$ godef -f pkg/data/codebook/codebook.go csv.Reader
parseLocalPackage error: no more package files found
godef: no declaration found for csv.Reader
$ export GOROOT=/home/duncan/.go/go1.9
$ godef -f pkg/data/codebook/codebook.go csv.Reader
/home/duncan/.go/go1.9/src/encoding/csv/reader.go:90:6
$ set | fgrep GO
GOPATH=/home/duncan/.local
GOROOT=/home/duncan/.go/go1.9
$ 
@yaojingguo
Copy link

I have the same problem. I am using Go 1.9.1.

@csuzuliangpan
Copy link

the same prooblem,did you fand the way?come share

@yaojingguo
Copy link

You can try to set GOPATH.

croaky added a commit to croaky/laptop that referenced this issue Apr 23, 2018
`:GoDef` (and `gd`) in Vim was broken for the standard library.

rogpeppe/godef#73

Try and find a different approach in the long-run.
Setting `GOROOT` is not recommended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants