-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
$ go version
go version go1.8.1 linux/amd64
What operating system and processor architecture are you using (go env)?
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/dominic/dev"
GORACE=""
GOROOT="/usr/lib/go-1.8"
GOTOOLDIR="/usr/lib/go-1.8/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build184946284=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
The very first time I run goimports (ie: "cold") on a file that has any third-party imports, it is painfully slow. (30-60s in most cases) The complexity of the file (ie: LOC and number of imports) seems to matter very little, if at all.
After that initial run, it is blazing fast (<300ms) for every subsequent file.
What did you expect to see?
I don't get the impression that goimports runs slowly as a general rule, so I expect it to be much faster than what I get.
What did you see instead?
That initial run is painful, especially because I use a text editor that runs goimports automatically on save. I end up needing to trigger some trivial goimports manually in a terminal in order for my text editor to not freeze up on each save.
I have a lot of repos in my $GOPATH, but before I start blowing packages away I would like to see if there's something else I may have misconfigured or could try to address this.
I only have this trouble on my linux desktop. I also develop on a mac laptop, but never have trouble with goimports there. (and I believe the size of $GOPATH is comparable since I use both for work) It seems to be a linux-exclusive issue for me.