godef icon indicating copy to clipboard operation
godef copied to clipboard

godef by expression not working with go/packages

Open segevfiner opened this issue 7 years ago • 5 comments

I think this works without go/packages:

  1. Create hello.go:
package main

import "fmt"

func main() {
	fmt.Println("Hello, World!")
}
  1. go mod init.
  2. Run godef -f hello.go fmt.Println.
  3. You get the error: godef: Offset -1 was not a valid identifier

segevfiner avatar Dec 25 '18 00:12 segevfiner

try godef -t -f hello.go -o 43, you may get

xxx/hello.go:3:8
import (fmt "fmt")

sunliver avatar Dec 25 '18 09:12 sunliver

try godef -t -f hello.go -o 43, you may get

xxx/hello.go:3:8
import (fmt "fmt")

This is about the expression mode not working. Offset mode still works.

segevfiner avatar Dec 26 '18 19:12 segevfiner

Mod is not supporting expression now, it uses https://godoc.org/golang.org/x/tools/go/packages to find definition.

sunliver avatar Dec 27 '18 04:12 sunliver