Use the :GoDoc command on any func such as: fmt.Println()
Show GoDoc of the function
I receive the following error:
vim-go: no package to containing file /Users/colinchan/Go/src/github.com/colinchan15/hell
o/hello.go
vim-go version:
latest master branch
commit 1896764
vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):
" Begin of vim-plug manager
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
" End of vim-plug manager
call plug#end()
Vim version (first three lines from :version):
VIM v8.1
Go version (go version):
go version go1.11.3 darwin/amd64
Go environment (go env):
go version go1.11.3 darwin/amd64
Colins-MacBook-Pro:bin colinchan$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/colinchan/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/colinchan/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.3/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.3/libexec/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/5p/hg6hlg9j2tb95y5v6_9x7hj00000gn/T/go-build524783734=/tmp/go-build -gno-record-gcc-switches -fno-common"
I've taken a look at issue #332 and have tried all solutions, but I'm still getting the same issue.
I think this may be a case insenstivity issue. The errors references /Users/colinchan/Go, but your GOPATH is /Users/colinchan/go. If you rename your /Users/colinchan/Go to /Users/colinchan/go, do you still experience the issue?
@bhcleek Good call on that, it completely slipped me! That's completely solved the issue. Thanks!
What's my problem?
vim-go: no package to containing file /home/user/Desktop/hello.go
(Bashrc)
### Go ##
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
(go env)
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build725025653=/tmp/go-build -gno-record-gcc-switches"
!godoc fmt works fine though
@GetCurious You're not in $GOPATH.
i have same problem
```
echo $GOPATH
/home/myusername/go
``````
my file project is in/home/myusername/work/golang/projectfolder1
GoDoc get me
vim-go: no package to containing file /home/myusername/work/golang/projectfolder1/main.go
other project i clone from [this repository](https://github.com/gokcehan/lf) work fine.
i open/home/myusername/work/golang/lf/main.go` and GoDoc work correct
Most helpful comment
@GetCurious You're not in
$GOPATH.