fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
16.03k stars 1.45k forks source link

GoDef returns "vim-go: guru no object for identifier" #851

Closed aletheia7 closed 8 years ago

aletheia7 commented 8 years ago

Actual behavior

Put cursor on a func such as zmq4.NewSocket(zmq4.ROUTER) and type :GoDef.

Expected behavior

vim would open a new window just like it does for log.Println().

Steps to reproduce:

Please create a reproducible case of your problem. Re produce it with a minimal vimrc with all plugins disabled and only vim-go enabled:

  1. Create a go test program using the following source code:

    package main                                                                                                                                                                                   
    
    import (                                                                                                                                                                                       
    "github.com/pebbe/zmq4"                                                                                                                                                                    
    "log"                                                                                                                                                                                      
    "time"                                                                                                                                                                                     
    )                                                                                                                                                                                              
    
    func main() {                                                                                                                                                                                  
    log.Println("Hello")                                                                                                                                                                       
    var s *zmq4.Socket                                                                                                                                                                         
    s, err := zmq4.NewSocket(zmq4.ROUTER)                                                                                                                                                      
    if err != nil {                                                                                                                                                                            
       log.Fatalln(err)                                                                                                                                                                       
    }                                                                                                                                                                                          
    defer s.Close()                                                                                                                                                                            
    log.Println(time.Now())                                                                                                                                                                    
    } 
  2. Place cursor on NewSocket
  3. Enter :GoDef

    Configuration

Add here your current configuration and additional information that might be useful, such as:

fatih commented 8 years ago

Hi @aletheia7. That's because probably of cgo and how guru finds them. There is not much I can do on vim-go because the underlying guru can't find these. Please open an issue on https://github.com/golang/go/issues to get more information. Thanks

aletheia7 commented 8 years ago

Thank you.

aletheia7 commented 8 years ago

@fatih

I opened an issue for guru as recommended above. guru can parse packages under vendor, but it does not parse packages under vendor that import "C." See: https://github.com/golang/go/issues/15710 for details. Perhaps you may want to add a note in :h vim-go or your README.md in order to clear-up any confusion with vim-go when this conditions occurs.

ta3pks commented 6 years ago

@fatih i dont even have cgo but i have the same problem it actually gives me error right after i open any go file

ta3pks commented 6 years ago

actually my error message says no identifier here

ta3pks commented 6 years ago

aletheia7 commented 6 years ago

go 1.9 fixed this issue.

ta3pks commented 6 years ago

i actually have go1.9 and this issue start to happen out of nowhere just yesterday when i updated the plugins

aletheia7 commented 6 years ago

Try

  1. Upgrade to go 1.9
  2. GoUpdateBinaries
ta3pks commented 6 years ago

im already using 1.9 @aletheia7

aletheia7 commented 6 years ago

Do 2.

ta3pks commented 6 years ago

i did already and actually nothing changes

aletheia7 commented 6 years ago

Remove all plugins except vim-go. Work? If so, add plugins one-by-one until you find the problem.

ta3pks commented 6 years ago

now i dont have any plugin installed except color scheme wakatime and vim-go yet i still get the same error

ta3pks commented 6 years ago

@aletheia7 can we continue under #1590

aletheia7 commented 6 years ago

@NikosEfthias sure