godef
godef copied to clipboard
godef might be extremly slow in Go packages using cgo when using go/packages
I noticed that godef is now conditionally using go/packages . I had an encountered an issue with gogetdoc that is caused by go/packages. go/packages invokes go list -compiled (golang/tools/go/packages/golist.go#L630) unconditionally, which compiles any cgo packages in the list, without any caching.
This can get prohibitively slow to the point that it made gogetdoc unusable when such packages are in the list.
Steps to reproduce
You need to have ImageMagick available. (See https://github.com/gographics/imagick)
- Save the following as
main.goin a new go package directory:
package main
import "gopkg.in/gographics/imagick.v2/imagick"
func main() {
imagick.Initialize()
}
-
dep init. -
godef -pos main.go:#87.
I haven't yet gotten around to check if this reproduces.
godetdoc issue: https://github.com/zmb3/gogetdoc/issues/47