Please answer these questions before submitting your issue. Thanks!
go version)?
go version go1.6.2 darwin/amd64
go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/romeo/code/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.6.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.6.2/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
```
$ tree vendor -d -L 2
vendor
βββ github.com
βΒ Β βββ BurntSushi
βΒ Β βββ TheThingsNetwork
βΒ Β βββ apex
βΒ Β βββ boltdb
βΒ Β βββ brocaar
βΒ Β βββ dgrijalva
βΒ Β βββ eclipse
βΒ Β βββ fsnotify
βΒ Β βββ golang
βΒ Β βββ googollee
βΒ Β βββ gorilla
βΒ Β βββ hashicorp
βΒ Β βββ jacobsa
βΒ Β βββ labstack
βΒ Β βββ magiconair
βΒ Β βββ mattn
βΒ Β βββ mitchellh
βΒ Β βββ rcrowley
βΒ Β βββ robertkrimen
βΒ Β βββ smartystreets
βΒ Β βββ spf13
βΒ Β βββ tj
βΒ Β βββ valyala
βββ golang.org
βΒ Β βββ x
βββ google.golang.org
βΒ Β βββ appengine
βΒ Β βββ cloud
βΒ Β βββ grpc
βββ gopkg.in
βββ bsm
βββ redis.v3
βββ sourcemap.v1
βββ yaml.v2
35 directories
```
And now goimports is really slow:
$ time goimports routes/events.go 1>/dev/null
goimports routes/events.go > /dev/null 3.45s user 9.69s system 331% cpu 3.964 total
However if I remove the vendored library and get the dependencies into my $GOPATH:
rm -r vendor
go get
goimports is really fast again:
$ time goimports routes/events.go 1>/dev/null
goimports routes/events.go 1>/dev/null 0.01s user 0.01s system 68% cpu 0.032 total
$GOPATH.Good timing. I was annoyed by goimports' performance recently and started investigating today during the Gophercon hack day. I have a change on my laptop to make things much faster.
It's doing way more work than necessary.
Can't wait for the CL.
CL https://golang.org/cl/24941 mentions this issue.
CL https://golang.org/cl/24948 mentions this issue.
CL https://golang.org/cl/24971 mentions this issue.
CL https://golang.org/cl/25001 mentions this issue.
I think it's fast enough to close this now.
Most helpful comment
Good timing. I was annoyed by goimports' performance recently and started investigating today during the Gophercon hack day. I have a change on my laptop to make things much faster.
It's doing way more work than necessary.