Golang: go to definition does not work for standard library or dependencies



When triggering “jumptodef” in a golang project, it does not work for exports from the standard library or dependencies. It does in vim, and it’s very practical to go check the source code of a stdlib method or what a dependency does.

How to reproduce:

  • create a valid golang project directory in GOPATH
  • create a main.go file in the directory
  • add the following sample code:
package main

import "fmt"

func main(){
    fmt.Println("jumptodef does not work")
  • position cursor on Println in the code above
  • trigger “jumptodef”

Expected behavior:

  • open the standard library file for the fmt package and position the cursor on the definition of Println

Actual behavior:

  • cursor stays where it is and nothing happens