-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.11.4 windows/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env set GOARCH=amd64 set GOBIN= set GOCACHE=<snip>\AppData\Local\go-build set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=<snip>\go set GOPROXY= set GORACE= set GOROOT=C:\Go set GOTMPDIR= set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64 set GCCGO=gccgo set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD= set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=<snip>\Temp\go-build664130090=/tmp/go-build -gno-record-gcc-switches
What did you do?
I tried using a Go tool that uses golang.org/x/go/tools/packages
under the hood (Specifically gogetdoc
, but many more tools are going to use it in order to support Go modules). Since packages
unconditionally calls go list -compiled
(go/tools/go/packages/golist.go:630), when there are large cgo modules anywhere on the module list, packages
will cause them to be compiled, without any caching. This can take a very long time and makes any tool doing so unusably slow.
Steps to reproduce
You need to have ImageMagick available. (See https://github.com/gographics/imagick)
- Save the following as
main.go
in a new go package directory:
package main
import "gopkg.in/gographics/imagick.v2/imagick"
func main() {
imagick.Initialize()
}
dep init
/go get
/whatever.gogetdoc -pos main.go:#87
.
What did you expect to see?
The tool works fast.
What did you see instead?
It's extremely slow, to the point of being unusable.
Related issues
zmb3/gogetdoc#47
microsoft/vscode-go#667
microsoft/vscode-go#1025
rogpeppe/godef#103
liugangnhm and akyoto