<p>I really try my best not to use this subreddit as stack overflow, but I am a bit stumped by an error I'm getting and can't find any evidence that anyone has ever asked about the error message I get as google returns zero results.</p>
<p>I got assigned an existing project and pulled the repo into my gopath, I'm trying to understand the code, so i ran :GoDef on a function and got an error I haven't seen before.</p>
<p><code>
vim-go: guru: cannot load package in root of source directory *GOPATH/src/github.com/*name*/*directory/*subdirectory^@
</code></p>
<p>In any other directory in my gopath, I have no problems with GoDef. I can't find any results on this error. </p>
<p>Has anyone dealt with this before? Can anyone explain what it is I don't understand here?</p>
<p>EDIT: After playing around some more, I have found that I can run :GoDef on functions that are defined in outside packages, but not ones that are defined in my main package.</p>
<hr/>**评论:**<br/><br/>x7C3: <pre><p>Have you installed the vim-go required packages? I <em>think</em> its <code>:GoInstall</code></p></pre>kostix: <pre><p>Almost correct: it's <code>:GoInstallBinaries</code>. To cite <a href="https://github.com/fatih/vim-go" rel="nofollow">the documentation</a>:</p>
<blockquote>
<p>Please be sure all necessary binaries are installed
(such as gocode, godef, goimports, etc.).
You can easily install them with the included
<code>:GoInstallBinaries</code>command.
If invoked, all necessary binaries will be automatically downloaded
and installed to your <code>$GOBIN</code> environment
(if not set it will use <code>$GOPATH/bin</code>).
Note that this command requires git for fetching the individual Go packages.
Additionally, use <code>:GoUpdateBinaries</code> to update the installed binaries.</p>
</blockquote>
<p>The <code>:GoInstall</code> command runs <code>go install</code> on your project.</p>
<p>To the OP: <a href="/u/x7C3" rel="nofollow">/u/x7C3</a> is correct: <code>vim-go</code> by default works more like the venerable (and removed since some time ago) filetype plugin and syntax highlighter for Go once shipped with Go itself. Basically it implements a set of simple commands like running <code>go fmt</code> on the opened file, building and installing your project, running its tests etc.</p>
<p>In order to do real heavy-lifting, <code>vim-go</code> makes use of 3rd-party tooling which it's able to fetch from their well-known locations, compile and install in your default Go workspace, and then use.</p></pre>hoverage: <pre><p>I have. I should mention that I have 3 personal projects in my gopath that have no problems running any vim-go commands at all. It's only in this one, single, project that I cloned. I can't figure it out. Nobody has used this error message, but I was hoping that would be something obvious to people here. </p>
<p>I get autocompletion on all structs and functions from within other files, but I cannot jump to the definition of the struct or function using GoDef (or GoDoc even) in this one project.</p></pre>
![](https://static.golangjob.cn/static/img/banner.png)