Skip to content

Instantly share code, notes, and snippets.

@myitcv
Created October 31, 2018 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myitcv/bbe8a91813e7a8fc5d2fc599013cf305 to your computer and use it in GitHub Desktop.
Save myitcv/bbe8a91813e7a8fc5d2fc599013cf305 to your computer and use it in GitHub Desktop.
goimports speed repro
(
set -eo pipefail
export GOPATH=$(mktemp -d)
export GO111MODULE=off
go get golang.org/x/tools/cmd/goimports
cd $(go list -f "{{.Dir}}" golang.org/x/tools/go/packages)
git fetch https://go.googlesource.com/tools refs/changes/97/142697/6 && git checkout FETCH_HEAD
sed -i 's/^var Debug = false$/var Debug = true/' golist.go
go install golang.org/x/tools/cmd/goimports
export GO111MODULE=on
cd $(mktemp -d)
go mod init example.com/hello
cat <<EOD > main.go
package main
import (
"fmt"
"os/exec"
)
func main() {
b, err := exec.LookPath("bash")
fmt.Printf("find bash: %v, %v", b, err)
}
EOD
go test
sed -i '/"os\/exec"/d' main.go
go test || true
time $GOPATH/bin/goimports main.go > /dev/null
time $GOPATH/bin/goimports main.go > /dev/null
time $GOPATH/bin/goimports main.go > /dev/null
pushd $(mktemp -d)
git clone https://github.com/docker/docker .
git checkout 547f11d84cb79eea46034583053083f5f1cc8033
go mod init github.com/docker/docker
go mod tidy
go mod download
popd
cat <<EOD > main.go
package main
import (
"fmt"
"os/exec"
)
func main() {
b, err := exec.LookPath("bash")
fmt.Printf("find bash: %v, %v", b, err)
}
EOD
go test
sed -i '/"os\/exec"/d' main.go
go test || true
time $GOPATH/bin/goimports main.go > /dev/null
time $GOPATH/bin/goimports main.go > /dev/null
time $GOPATH/bin/goimports main.go > /dev/null
) 2>&1 | tee output.txt
$ export GOPATH=$(mktemp -d)
$ export GO111MODULE=off
$ go get golang.org/x/tools/cmd/goimports
$ cd $(go list -f "{{.Dir}}" golang.org/x/tools/go/packages)
$ git fetch https://go.googlesource.com/tools refs/changes/97/142697/6 && git checkout FETCH_HEAD
From https://go.googlesource.com/tools
* branch refs/changes/97/142697/6 -> FETCH_HEAD
HEAD is now at 95a828d4... imports: use go/packages, support modules
$ sed -i 's/^var Debug = false$/var Debug = true/' golist.go
$ go install golang.org/x/tools/cmd/goimports
$ export GO111MODULE=on
$ cd $(mktemp -d)
$ go mod init example.com/hello
go: creating new go.mod: module example.com/hello
$ cat <<EOD >main.go
package main
import (
"fmt"
"os/exec"
)
func main() {
b, err := exec.LookPath("bash")
fmt.Printf("find bash: %v, %v", b, err)
}
EOD
$ go test
? example.com/hello [no test files]
$ sed -i '/"os\/exec"/d' main.go
$ go test || true
# example.com/hello
./main.go:8:12: undefined: exec
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 21:37:35 84.712124ms for driver [.]
2018/10/31 21:37:35 84.943246ms for query []
2018/10/31 21:37:35 scanning /go/src
2018/10/31 21:37:35 scanned /go/src
2018/10/31 21:37:35 scanning /tmp/tmp.bEbjr17AKc
2018/10/31 21:37:35 scanned /tmp/tmp.bEbjr17AKc
2018/10/31 21:37:35 skipping nonexistant directory: /tmp/tmp.NLq6BBzXvK/pkg/mod
2018/10/31 21:37:35 4.614299ms for walk
2018/10/31 21:37:35 127.6546ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 21:37:35 151.13959ms for query []
real 0m0.254s
user 0m0.248s
sys 0m0.157s
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 21:37:35 79.863652ms for driver [.]
2018/10/31 21:37:35 80.060643ms for query []
2018/10/31 21:37:35 scanning /go/src
2018/10/31 21:37:35 scanned /go/src
2018/10/31 21:37:35 scanning /tmp/tmp.bEbjr17AKc
2018/10/31 21:37:35 scanned /tmp/tmp.bEbjr17AKc
2018/10/31 21:37:35 skipping nonexistant directory: /tmp/tmp.NLq6BBzXvK/pkg/mod
2018/10/31 21:37:35 4.683442ms for walk
2018/10/31 21:37:35 89.683252ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 21:37:35 112.570011ms for query []
real 0m0.211s
user 0m0.202s
sys 0m0.133s
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 21:37:35 81.867038ms for driver [.]
2018/10/31 21:37:35 81.973327ms for query []
2018/10/31 21:37:35 scanning /go/src
2018/10/31 21:37:35 scanned /go/src
2018/10/31 21:37:35 scanning /tmp/tmp.bEbjr17AKc
2018/10/31 21:37:35 scanned /tmp/tmp.bEbjr17AKc
2018/10/31 21:37:35 skipping nonexistant directory: /tmp/tmp.NLq6BBzXvK/pkg/mod
2018/10/31 21:37:35 4.795607ms for walk
2018/10/31 21:37:35 87.489761ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 21:37:35 108.445911ms for query []
real 0m0.208s
user 0m0.200s
sys 0m0.138s
$ pushd $(mktemp -d)
/tmp/tmp.ZiMB4XPlbm /tmp/tmp.bEbjr17AKc
$ git clone https://github.com/docker/docker .
Cloning into '.'...
$ git checkout 547f11d84cb79eea46034583053083f5f1cc8033
HEAD is now at 547f11d84... Merge pull request #38103 from tonistiigi/cluster-grpc-limits
$ go mod init github.com/docker/docker
go: creating new go.mod: module github.com/docker/docker
go: copying requirements from vendor.conf
go: converting vendor.conf: stat github.com/Nvveen/Gotty@a8b993ba6abdb0e0c12b0125c603323a71c7790c: unknown revision a8b993ba6abdb0e0c12b0125c603323a71c7790c
go: converting vendor.conf: stat github.com/hashicorp/go-immutable-radix@826af9ccf0feeee615d546d69b11f8e98da8c8f1: unknown revision 826af9ccf0feeee615d546d69b11f8e98da8c8f1
go: converting vendor.conf: stat github.com/go-check/check@4ed411733c5785b40214c70bce814c3a3a689609: unknown revision 4ed411733c5785b40214c70bce814c3a3a689609
$ go mod tidy
go: finding github.com/coreos/etcd v3.3.9+incompatible
go: finding github.com/containerd/continuity v0.0.0-20181001140422-bd77b46c8352
go: finding github.com/vishvananda/netns v0.0.0-20150710222425-604eaf189ee8
go: finding github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f
go: finding github.com/ugorji/go v1.1.1
go: finding github.com/tinylib/msgp v0.0.0-20171013044219-3b556c645408
go: finding github.com/docker/libtrust v0.0.0-20150526203908-9cbd2a1374f4
go: finding github.com/containerd/ttrpc v0.0.0-20180920185216-2a805f718635
go: finding github.com/opencontainers/runtime-spec v0.0.0-20180909173843-eba862dc2470
go: finding github.com/googleapis/gax-go v2.0.0+incompatible
go: finding github.com/gogo/protobuf v1.0.0
go: finding github.com/opencontainers/image-spec v1.0.1
go: finding github.com/pborman/uuid v0.0.0-20160209185913-a97ce2ca70fa
go: finding github.com/spf13/pflag v1.0.1
go: finding github.com/kr/pty v0.0.0-20150511174710-5cf931ef8f76
go: finding github.com/docker/go-units v0.3.3
go: finding github.com/golang/gddo v0.0.0-20180130204405-9b12a26f3fbd
go: finding github.com/mistifyio/go-zfs v0.0.0-20160425201758-22c9b32c84eb
go: finding github.com/samuel/go-zookeeper v0.0.0-20150415181332-d0e0d8e11f31
go: finding github.com/sirupsen/logrus v1.0.6
go: finding github.com/hashicorp/go-msgpack v0.0.0-20140221154404-71c2886f5a67
go: finding github.com/vdemeester/shakers v0.1.0
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/godbus/dbus v4.0.0+incompatible
go: finding github.com/Graylog2/go-gelf v0.0.0-20171211094031-414364622654
go: finding github.com/philhofer/fwd v0.0.0-20160129035939-98c11a7a6ec8
go: finding github.com/gogo/googleapis v1.0.0
go: finding github.com/containerd/cri v0.0.0-20180917182010-9f39e3289533
go: finding github.com/aws/aws-sdk-go v1.12.66
go: finding github.com/hashicorp/memberlist v0.0.0-20171201184301-3d8438da9589
go: finding github.com/docker/go-connections v0.4.0
go: finding github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78
go: finding github.com/mattn/go-shellwords v1.0.3
go: finding github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1
go: finding github.com/google/shlex v0.0.0-20150127133951-6f45313302b9
go: finding github.com/armon/go-radix v0.0.0-20150105235045-e39d623f12e8
go: finding github.com/fsnotify/fsnotify v1.4.7
go: finding github.com/hashicorp/serf v0.0.0-20160317193612-598c54895cc5
go: finding github.com/prometheus/client_golang v0.8.0
go: finding github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.0
go: finding github.com/fluent/fluent-logger-golang v1.3.0
go: finding github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452
go: finding github.com/gorilla/mux v0.0.0-20160317213430-0eeaf8392f5b
go: finding github.com/hashicorp/go-memdb v0.0.0-20161216180745-cb9a474f84cc
go: finding github.com/tonistiigi/fsutil v0.0.0-20181002165410-f567071bed24
go: finding github.com/golang/protobuf v1.1.0
go: finding github.com/docker/distribution v0.0.0-20180327202408-83389a148052
go: finding github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260
go: finding github.com/prometheus/procfs v0.0.0-20180612222113-7d6f385de8be
go: finding github.com/hashicorp/consul v0.5.2
go: finding github.com/BurntSushi/toml v0.0.0-20170626110600-a368813c5e64
go: finding github.com/vishvananda/netlink v0.0.0-20171020171820-b2de5d10e38e
go: finding github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
go: finding github.com/RackSec/srslog v0.0.0-20161121191927-456df3a81436
go: finding github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd
go: finding github.com/bsphere/le_go v0.0.0-20170215134836-7a984a84b549
go: finding github.com/docker/swarmkit v0.0.0-20181017185945-a84c01f49091
go: finding github.com/moby/buildkit v0.0.0-20181011194101-c7bb575343df
go: finding github.com/tchap/go-patricia v2.2.6+incompatible
go: finding github.com/inconshreveable/mousetrap v1.0.0
go: finding github.com/cloudflare/cfssl v0.0.0-20180323000720-5d63dbd981b5
go: finding github.com/hashicorp/go-multierror v0.0.0-20150127051936-fcdddc395df1
go: finding github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1
go: finding github.com/miekg/dns v1.0.7
go: finding github.com/imdario/mergo v0.3.6
go: finding github.com/docker/go-metrics v0.0.0-20170502235133-d466d4f6fd96
go: finding github.com/go-ini/ini v1.25.4
go: finding github.com/docker/libkv v0.0.0-20180912205406-458977154600
go: finding github.com/containerd/containerd v1.2.0-rc.1
go: finding github.com/deckarep/golang-set v0.0.0-20141123011944-ef32fa3046d9
go: finding github.com/syndtr/gocapability v0.0.0-20150716010906-2c00daeb6c3b
go: finding github.com/Microsoft/opengcs v0.3.9
go: finding github.com/opencontainers/go-digest v1.0.0-rc1
go: finding github.com/prometheus/client_model v0.0.0-20170216185247-6f3806018612
go: finding github.com/fernet/fernet-go v0.0.0-20151007213151-1b2437bc582b
go: finding github.com/opentracing/opentracing-go v0.0.0-20171003133519-1361b9cd60be
go: finding github.com/docker/go-events v0.0.0-20170721190031-9461782956ad
go: finding github.com/containerd/cgroups v0.0.0-20180515175038-5e610833b720
go: finding github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86
go: finding github.com/google/certificate-transparency-go v1.0.20
go: finding go.etcd.io/bbolt v1.3.1-etcd.8
go: finding github.com/vbatts/tar-split v0.11.0
go: finding github.com/seccomp/libseccomp-golang v0.0.0-20160531183505-32f571b70023
go: finding github.com/google/go-cmp v0.2.0
go: finding github.com/opencontainers/selinux v0.0.0-20180628160156-b6fa367ed7f5
go: finding github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3
go: finding github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf
go: finding github.com/ishidawataru/sctp v0.0.0-20180213033435-07191f837fed
go: finding github.com/armon/go-metrics v0.0.0-20150106224455-eb0af217e5e9
go: finding github.com/Microsoft/go-winio v0.4.11
go: finding golang.org/x/oauth2 v0.0.0-20180529203656-ec22f46f877b
go: finding github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47
go: finding golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2
go: finding golang.org/x/text v0.3.0
go: finding github.com/opencontainers/runc v0.0.0-20181016003215-a00bf0190895
go: finding github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645
go: finding github.com/pivotal-golang/clock v0.0.0-20151018222946-3fd3c1944c59
go: finding github.com/opentracing-contrib/go-stdlib v0.0.0-20171029140428-b1a47cfbdd75
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding github.com/spf13/cobra v0.0.3
go: finding google.golang.org/grpc v1.12.0
go: finding google.golang.org/genproto v0.0.0-20180523212516-694d95ba50e6
go: finding google.golang.org/api v0.0.0-20180530150455-de943baf05a0
go: finding github.com/docker/libnetwork v0.0.0-20181012153825-d7b61745d166
go: finding go.opencensus.io v0.11.0
go: finding github.com/Microsoft/hcsshim v0.7.9
go: finding github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go: finding github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
go: finding github.com/coreos/go-semver v0.2.0
go: finding golang.org/x/sys v0.0.0-20180715085529-ac767d655b30
go: finding golang.org/x/net v0.0.0-20180719180050-a680a1efc54d
go: finding golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
go: finding gotest.tools v2.1.0+incompatible
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: finding cloud.google.com/go v0.23.0
go: downloading golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: downloading github.com/opencontainers/runc v0.0.0-20181016003215-a00bf0190895
go: downloading github.com/moby/buildkit v0.0.0-20181011194101-c7bb575343df
go: downloading github.com/opencontainers/go-digest v1.0.0-rc1
go: downloading github.com/Microsoft/hcsshim v0.7.9
go: downloading github.com/docker/go-metrics v0.0.0-20170502235133-d466d4f6fd96
go: downloading github.com/docker/swarmkit v0.0.0-20181017185945-a84c01f49091
go: downloading gotest.tools v2.1.0+incompatible
go: downloading github.com/docker/go-connections v0.4.0
go: downloading github.com/docker/distribution v0.0.0-20180327202408-83389a148052
go: downloading github.com/containerd/containerd v1.2.0-rc.1
go: downloading github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78
go: downloading github.com/docker/go-units v0.3.3
go: downloading google.golang.org/grpc v1.12.0
go: downloading github.com/BurntSushi/toml v0.0.0-20170626110600-a368813c5e64
go: downloading github.com/Microsoft/opengcs v0.3.9
go: downloading golang.org/x/sys v0.0.0-20180715085529-ac767d655b30
go: downloading github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260
go: downloading github.com/gorilla/mux v0.0.0-20160317213430-0eeaf8392f5b
go: downloading github.com/gogo/protobuf v1.0.0
go: finding github.com/bfirsh/funker-go latest
go: downloading github.com/containerd/cgroups v0.0.0-20180515175038-5e610833b720
go: finding github.com/hashicorp/go-immutable-radix v1.0.0
go: downloading github.com/docker/libnetwork v0.0.0-20181012153825-d7b61745d166
go: downloading github.com/hashicorp/go-immutable-radix v1.0.0
go: downloading github.com/opencontainers/image-spec v1.0.1
go: downloading go.etcd.io/bbolt v1.3.1-etcd.8
go: downloading github.com/vbatts/tar-split v0.11.0
go: downloading github.com/tchap/go-patricia v2.2.6+incompatible
go: downloading github.com/containerd/continuity v0.0.0-20181001140422-bd77b46c8352
go: downloading github.com/spf13/pflag v1.0.1
go: downloading github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f
go: downloading golang.org/x/net v0.0.0-20180719180050-a680a1efc54d
go: downloading github.com/vishvananda/netlink v0.0.0-20171020171820-b2de5d10e38e
go: downloading golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
go: downloading github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7
go: downloading github.com/imdario/mergo v0.3.6
go: downloading github.com/godbus/dbus v4.0.0+incompatible
go: downloading github.com/google/go-cmp v0.2.0
go: downloading google.golang.org/genproto v0.0.0-20180523212516-694d95ba50e6
go: downloading github.com/tonistiigi/fsutil v0.0.0-20181002165410-f567071bed24
go: downloading github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd
go: downloading github.com/coreos/etcd v3.3.9+incompatible
go: downloading github.com/opencontainers/selinux v0.0.0-20180628160156-b6fa367ed7f5
go: downloading github.com/docker/libkv v0.0.0-20180912205406-458977154600
go: downloading github.com/golang/protobuf v1.1.0
go: downloading github.com/cloudflare/cfssl v0.0.0-20180323000720-5d63dbd981b5
go: downloading github.com/Microsoft/go-winio v0.4.11
go: downloading cloud.google.com/go v0.23.0
go: downloading github.com/kr/pty v0.0.0-20150511174710-5cf931ef8f76
go: downloading github.com/golang/gddo v0.0.0-20180130204405-9b12a26f3fbd
go: downloading github.com/bfirsh/funker-go v0.0.0-20161231111542-eaa0a2e06f30
go: downloading github.com/pkg/errors v0.8.0
go: finding github.com/Nvveen/Gotty latest
go: downloading github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5
go: finding github.com/go-check/check latest
go: downloading github.com/go-check/check v0.0.0-20180628173108-788fd7840127
go: finding github.com/stretchr/testify/require latest
go: finding github.com/stretchr/testify/assert latest
go: downloading github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
go: downloading github.com/opencontainers/runtime-spec v0.0.0-20180909173843-eba862dc2470
go: downloading github.com/pborman/uuid v0.0.0-20160209185913-a97ce2ca70fa
go: downloading github.com/miekg/dns v1.0.7
go: downloading github.com/bsphere/le_go v0.0.0-20170215134836-7a984a84b549
go: downloading github.com/prometheus/client_golang v0.8.0
go: downloading github.com/docker/libtrust v0.0.0-20150526203908-9cbd2a1374f4
go: downloading github.com/vishvananda/netns v0.0.0-20150710222425-604eaf189ee8
go: downloading github.com/ishidawataru/sctp v0.0.0-20180213033435-07191f837fed
go: downloading github.com/mistifyio/go-zfs v0.0.0-20160425201758-22c9b32c84eb
go: downloading github.com/mattn/go-shellwords v1.0.3
go: downloading github.com/spf13/cobra v0.0.3
go: downloading github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47
go: downloading github.com/inconshreveable/mousetrap v1.0.0
go: downloading github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: downloading github.com/fluent/fluent-logger-golang v1.3.0
go: downloading github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1
go: downloading github.com/opentracing/opentracing-go v0.0.0-20171003133519-1361b9cd60be
go: downloading github.com/RackSec/srslog v0.0.0-20161121191927-456df3a81436
go: downloading github.com/opentracing-contrib/go-stdlib v0.0.0-20171029140428-b1a47cfbdd75
go: downloading github.com/pivotal-golang/clock v0.0.0-20151018222946-3fd3c1944c59
go: downloading github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1
go: downloading github.com/hashicorp/go-memdb v0.0.0-20161216180745-cb9a474f84cc
go: downloading golang.org/x/oauth2 v0.0.0-20180529203656-ec22f46f877b
go: downloading github.com/syndtr/gocapability v0.0.0-20150716010906-2c00daeb6c3b
go: downloading github.com/armon/go-radix v0.0.0-20150105235045-e39d623f12e8
go: downloading github.com/tinylib/msgp v0.0.0-20171013044219-3b556c645408
go: downloading github.com/googleapis/gax-go v2.0.0+incompatible
go: downloading go.opencensus.io v0.11.0
go: downloading github.com/gogo/googleapis v1.0.0
go: downloading golang.org/x/text v0.3.0
go: downloading github.com/google/shlex v0.0.0-20150127133951-6f45313302b9
go: downloading github.com/aws/aws-sdk-go v1.12.66
go: finding github.com/stretchr/testify/suite latest
go: downloading google.golang.org/api v0.0.0-20180530150455-de943baf05a0
go: finding github.com/phayes/permbits latest
go: finding github.com/satori/go.uuid v1.2.0
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding github.com/stretchr/testify v1.2.2
go: downloading github.com/stretchr/testify v1.2.2
go: finding github.com/docker/docker/autogen/winresources/dockerd latest
go: downloading github.com/satori/go.uuid v1.2.0
go: downloading github.com/phayes/permbits v0.0.0-20180830030258-59f2482cd460
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.0
go: downloading github.com/Graylog2/go-gelf v0.0.0-20171211094031-414364622654
go: downloading github.com/ugorji/go v1.1.1
go: downloading gopkg.in/yaml.v2 v2.2.1
go: downloading golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2
go: downloading github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645
go: downloading github.com/prometheus/client_model v0.0.0-20170216185247-6f3806018612
go: downloading github.com/docker/go-events v0.0.0-20170721190031-9461782956ad
go: downloading github.com/seccomp/libseccomp-golang v0.0.0-20160531183505-32f571b70023
go: downloading github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf
go: downloading github.com/google/certificate-transparency-go v1.0.20
go: downloading github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3
go: downloading github.com/fernet/fernet-go v0.0.0-20151007213151-1b2437bc582b
go: downloading github.com/prometheus/procfs v0.0.0-20180612222113-7d6f385de8be
go: downloading github.com/deckarep/golang-set v0.0.0-20141123011944-ef32fa3046d9
go: downloading github.com/go-ini/ini v1.25.4
go: finding github.com/soheilhy/cmux v0.1.4
go: finding github.com/golang/groupcache/lru latest
go: finding github.com/golang/protobuf/proto/testdata latest
go: downloading github.com/fsnotify/fsnotify v1.4.7
go: downloading github.com/containerd/ttrpc v0.0.0-20180920185216-2a805f718635
go: downloading github.com/sirupsen/logrus v1.0.6
go: downloading github.com/containerd/cri v0.0.0-20180917182010-9f39e3289533
go: downloading github.com/samuel/go-zookeeper v0.0.0-20150415181332-d0e0d8e11f31
go: downloading github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452
go: finding google.golang.org/appengine/urlfetch latest
go: finding google.golang.org/appengine/socket latest
go: finding github.com/coreos/bbolt v1.3.0
go: downloading github.com/soheilhy/cmux v0.1.4
go: finding gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2
go: downloading github.com/hashicorp/serf v0.0.0-20160317193612-598c54895cc5
go: finding github.com/dgrijalva/jwt-go v3.2.0+incompatible
go: downloading github.com/dgrijalva/jwt-go v3.2.0+incompatible
go: downloading github.com/philhofer/fwd v0.0.0-20160129035939-98c11a7a6ec8
go: finding google.golang.org/appengine v1.2.0
go: finding github.com/tmc/grpc-websocket-proxy/wsproxy latest
go: finding github.com/golang/groupcache latest
go: downloading github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff
go: downloading github.com/coreos/bbolt v1.3.0
go: downloading gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2
go: finding github.com/xiang90/probing latest
go: finding github.com/ghodss/yaml v1.0.0
go: finding github.com/jonboulle/clockwork v0.1.0
go: finding github.com/onsi/gomega v1.4.2
go: downloading google.golang.org/appengine v1.2.0
go: finding github.com/tmc/grpc-websocket-proxy latest
go: downloading github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6
go: downloading github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go: downloading github.com/vdemeester/shakers v0.1.0
go: downloading github.com/hashicorp/go-msgpack v0.0.0-20140221154404-71c2886f5a67
go: downloading github.com/hashicorp/consul v0.5.2
go: downloading github.com/armon/go-metrics v0.0.0-20150106224455-eb0af217e5e9
go: downloading github.com/coreos/go-semver v0.2.0
go: downloading github.com/ghodss/yaml v1.0.0
go: downloading github.com/hashicorp/memberlist v0.0.0-20171201184301-3d8438da9589
go: downloading github.com/jonboulle/clockwork v0.1.0
go: downloading github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86
go: finding github.com/golang/glog latest
go: finding github.com/bmizerany/assert latest
go: downloading github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18
go: finding github.com/golang/protobuf/proto latest
go: finding github.com/golang/protobuf v1.2.0
go: downloading github.com/golang/protobuf v1.2.0
go: downloading github.com/onsi/gomega v1.4.2
go: finding github.com/smartystreets/goconvey/convey latest
go: finding github.com/grpc-ecosystem/grpc-gateway/runtime latest
go: finding github.com/google/btree latest
go: downloading github.com/hashicorp/go-multierror v0.0.0-20150127051936-fcdddc395df1
go: downloading github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
go: finding camlistore.org/pkg/throttle latest
go: downloading github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869
go: finding github.com/onsi/ginkgo v1.6.0
go: downloading github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding github.com/grpc-ecosystem/grpc-gateway/utilities latest
go: finding github.com/vmihailenco/msgpack v4.0.1+incompatible
go: downloading github.com/vmihailenco/msgpack v4.0.1+incompatible
go: finding github.com/hashicorp/consul/lib latest
go: downloading github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
go: finding github.com/grpc-ecosystem/grpc-gateway v1.5.1
go: downloading github.com/grpc-ecosystem/grpc-gateway v1.5.1
go: finding github.com/smartystreets/goconvey latest
go: downloading github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a
go: finding github.com/hashicorp/hcl v1.0.0
go: downloading github.com/onsi/ginkgo v1.6.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: finding camlistore.org/pkg latest
go: finding camlistore.org latest
go: downloading camlistore.org v0.0.0-20171230002226-a5a65f0d8b22
go: finding labix.org/v2/mgo/bson latest
go: finding labix.org/v2/mgo latest
go: downloading labix.org/v2/mgo v0.0.0-20140701140051-000000000287
go: finding github.com/docker/docker/autogen/winresources latest
go: finding github.com/docker/docker/autogen latest
go: finding github.com/hashicorp/consul v1.3.0
go: downloading github.com/hashicorp/consul v1.3.0
go: finding golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
go: finding github.com/hashicorp/golang-lru v0.5.0
go: finding golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e
go: finding github.com/hpcloud/tail v1.0.0
go: finding golang.org/x/net v0.0.0-20180724234803-3673e40ba225
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/hashicorp/go-uuid v1.0.0
go: finding gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: finding gopkg.in/fsnotify.v1 v1.4.7
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: downloading golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e
go: downloading golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/hashicorp/golang-lru v0.5.0
go: downloading github.com/hashicorp/go-uuid v1.0.0
go: downloading gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: downloading github.com/hpcloud/tail v1.0.0
go: finding github.com/pmezard/go-difflib/difflib latest
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading gopkg.in/fsnotify.v1 v1.4.7
go: finding github.com/hashicorp/go-rootcerts latest
go: finding github.com/hashicorp/go-cleanhttp v0.5.0
go: finding github.com/mitchellh/go-testing-interface v1.0.0
go: finding github.com/pascaldekloe/goe/verify latest
go: finding github.com/kr/pretty v0.1.0
go: finding github.com/mitchellh/mapstructure v1.1.2
go: finding gopkg.in/airbrake/gobrake.v2 v2.0.9
go: finding github.com/armon/go-metrics/circonus latest
go: finding github.com/armon/go-metrics latest
go: finding github.com/hashicorp/yamux latest
go: downloading github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da
go: finding github.com/armon/go-metrics/datadog latest
go: finding github.com/boltdb/bolt v1.3.1
go: downloading github.com/hashicorp/go-cleanhttp v0.5.0
go: downloading github.com/mitchellh/go-testing-interface v1.0.0
go: finding github.com/armon/go-metrics/prometheus latest
go: downloading github.com/kr/pretty v0.1.0
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading gopkg.in/airbrake/gobrake.v2 v2.0.9
go: finding github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90
go: finding github.com/pascaldekloe/goe latest
go: downloading github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c
go: finding github.com/gorilla/websocket v1.4.0
go: finding github.com/smartystreets/assertions latest
go: downloading github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d
go: downloading github.com/boltdb/bolt v1.3.1
go: finding github.com/jtolds/gls v4.2.1+incompatible
go: downloading github.com/jtolds/gls v4.2.1+incompatible
go: downloading github.com/gorilla/websocket v1.4.0
go: downloading github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
go: finding launchpad.net/gocheck latest
go: downloading launchpad.net/gocheck v0.0.0-20140225173054-000000000087
go: finding github.com/kr/text v0.1.0
go: finding github.com/kr/pty v1.1.1
go: downloading github.com/kr/text v0.1.0
go: downloading github.com/kr/pty v1.1.1
go: finding github.com/mitchellh/go-homedir v1.0.0
go: finding github.com/gopherjs/gopherjs/js latest
go: finding github.com/DataDog/datadog-go/statsd latest
go: downloading github.com/mitchellh/go-homedir v1.0.0
go: finding github.com/circonus-labs/circonus-gometrics v2.2.4+incompatible
go: downloading github.com/circonus-labs/circonus-gometrics v2.2.4+incompatible
go: finding github.com/DataDog/datadog-go latest
go: downloading github.com/DataDog/datadog-go v0.0.0-20180822151419-281ae9f2d895
go: finding github.com/gopherjs/gopherjs latest
go: downloading github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1
go: finding github.com/hashicorp/go-retryablehttp latest
go: finding github.com/tv42/httpunix latest
go: finding github.com/circonus-labs/circonusllhist v0.1.0
go: downloading github.com/circonus-labs/circonusllhist v0.1.0
go: downloading github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926
go: downloading github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6
$ go mod download
$ popd
/tmp/tmp.bEbjr17AKc
$ cat <<EOD >main.go
package main
import (
"fmt"
"os/exec"
)
func main() {
b, err := exec.LookPath("bash")
fmt.Printf("find bash: %v, %v", b, err)
}
EOD
$ go test
? example.com/hello [no test files]
$ sed -i '/"os\/exec"/d' main.go
$ go test || true
# example.com/hello
./main.go:8:12: undefined: exec
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 21:39:46 91.49728ms for driver [.]
2018/10/31 21:39:46 91.586626ms for query []
2018/10/31 21:39:46 scanning /go/src
2018/10/31 21:39:46 scanned /go/src
2018/10/31 21:39:46 scanning /tmp/tmp.bEbjr17AKc
2018/10/31 21:39:46 scanned /tmp/tmp.bEbjr17AKc
2018/10/31 21:39:46 scanning /tmp/tmp.NLq6BBzXvK/pkg/mod
2018/10/31 21:39:46 Directory added to ignore list: /tmp/tmp.NLq6BBzXvK/pkg/mod/cache
2018/10/31 21:39:46 scanned /tmp/tmp.NLq6BBzXvK/pkg/mod
2018/10/31 21:39:46 48.38135ms for walk
2018/10/31 21:39:46 110.713871ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 21:40:31 44.394959993s for driver [github.com/docker/swarmkit/agent/exec github.com/docker/swarmkit/agent/exec/dockerapi github.com/smartystreets/goconvey/web/server/executor github.com/hashicorp/consul/command/exec github.com/hashicorp/consul/agent/exec github.com/moby/buildkit/executor github.com/onsi/gomega/gexec github.com/moby/buildkit/executor/runcexecutor github.com/moby/buildkit/executor/containerdexecutor github.com/moby/buildkit/executor/oci google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test]
2018/10/31 21:40:31 44.574742001s for query []
real 0m44.686s
user 0m27.911s
sys 0m9.506s
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 21:40:31 80.106358ms for driver [.]
2018/10/31 21:40:31 80.184808ms for query []
2018/10/31 21:40:31 scanning /go/src
2018/10/31 21:40:31 scanned /go/src
2018/10/31 21:40:31 scanning /tmp/tmp.bEbjr17AKc
2018/10/31 21:40:31 scanned /tmp/tmp.bEbjr17AKc
2018/10/31 21:40:31 scanning /tmp/tmp.NLq6BBzXvK/pkg/mod
2018/10/31 21:40:31 Directory added to ignore list: /tmp/tmp.NLq6BBzXvK/pkg/mod/cache
2018/10/31 21:40:31 scanned /tmp/tmp.NLq6BBzXvK/pkg/mod
2018/10/31 21:40:31 61.433515ms for walk
2018/10/31 21:40:31 100.243865ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 21:40:42 10.935153422s for driver [github.com/docker/docker/pkg/reexec github.com/docker/docker/daemon/cluster/executor github.com/docker/docker/daemon/exec github.com/docker/docker/daemon/cluster/executor/container github.com/docker/swarmkit/agent/exec github.com/docker/swarmkit/agent/exec/dockerapi github.com/smartystreets/goconvey/web/server/executor github.com/hashicorp/consul/agent/exec github.com/hashicorp/consul/command/exec github.com/moby/buildkit/executor github.com/onsi/gomega/gexec github.com/moby/buildkit/executor/runcexecutor github.com/moby/buildkit/executor/oci github.com/moby/buildkit/executor/containerdexecutor google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test]
2018/10/31 21:40:42 11.115954032s for query []
real 0m11.218s
user 0m4.641s
sys 0m2.380s
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 21:40:42 81.82765ms for driver [.]
2018/10/31 21:40:42 81.931995ms for query []
2018/10/31 21:40:42 scanning /go/src
2018/10/31 21:40:42 scanned /go/src
2018/10/31 21:40:42 scanning /tmp/tmp.bEbjr17AKc
2018/10/31 21:40:42 scanned /tmp/tmp.bEbjr17AKc
2018/10/31 21:40:42 scanning /tmp/tmp.NLq6BBzXvK/pkg/mod
2018/10/31 21:40:42 Directory added to ignore list: /tmp/tmp.NLq6BBzXvK/pkg/mod/cache
2018/10/31 21:40:42 scanned /tmp/tmp.NLq6BBzXvK/pkg/mod
2018/10/31 21:40:42 56.776029ms for walk
2018/10/31 21:40:42 92.741996ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 21:40:49 7.280069846s for driver [google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test github.com/docker/docker/pkg/reexec google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test github.com/docker/docker/daemon/exec github.com/docker/docker/daemon/cluster/executor github.com/docker/docker/daemon/cluster/executor/container github.com/docker/swarmkit/agent/exec github.com/docker/swarmkit/agent/exec/dockerapi github.com/smartystreets/goconvey/web/server/executor github.com/hashicorp/consul/command/exec github.com/onsi/gomega/gexec github.com/hashicorp/consul/agent/exec github.com/moby/buildkit/executor github.com/moby/buildkit/executor/oci github.com/moby/buildkit/executor/containerdexecutor github.com/moby/buildkit/executor/runcexecutor]
2018/10/31 21:40:49 7.449267932s for query []
real 0m7.552s
user 0m2.858s
sys 0m1.269s
=============================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment