Skip to content

Instantly share code, notes, and snippets.

@myitcv
Created October 31, 2018 22:41
Show Gist options
  • Save myitcv/a9fcd3c7af7ef816711c83b300ea2a9d to your computer and use it in GitHub Desktop.
Save myitcv/a9fcd3c7af7ef816711c83b300ea2a9d to your computer and use it in GitHub Desktop.
goimports speed repro fix
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
sed -i '/cmd\.Env = append/c\cmd.Env = append(append([]string{}, cfg.Env...), "PWD="+cfg.Dir, "GOPROXY=off")' 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
$ 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
$ sed -i '/cmd\.Env = append/c\cmd.Env = append(append([]string{}, cfg.Env...), "PWD="+cfg.Dir, "GOPROXY=off")' 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 22:28:01 82.883671ms for driver [.]
2018/10/31 22:28:01 83.013875ms for query []
2018/10/31 22:28:01 scanning /go/src
2018/10/31 22:28:01 scanned /go/src
2018/10/31 22:28:01 scanning /tmp/tmp.w99uuxDmKE
2018/10/31 22:28:01 scanned /tmp/tmp.w99uuxDmKE
2018/10/31 22:28:01 skipping nonexistant directory: /tmp/tmp.SFG4Iwkdvu/pkg/mod
2018/10/31 22:28:01 24.259432ms for walk
2018/10/31 22:28:01 174.60028ms for driver [cmd/vendor/github.com/google/pprof/internal/elfexec os/exec .]
2018/10/31 22:28:01 218.888981ms for query []
real 0m0.319s
user 0m0.241s
sys 0m0.206s
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 22:28:01 79.061727ms for driver [.]
2018/10/31 22:28:01 79.187112ms for query []
2018/10/31 22:28:01 scanning /go/src
2018/10/31 22:28:01 scanned /go/src
2018/10/31 22:28:01 scanning /tmp/tmp.w99uuxDmKE
2018/10/31 22:28:01 scanned /tmp/tmp.w99uuxDmKE
2018/10/31 22:28:01 skipping nonexistant directory: /tmp/tmp.SFG4Iwkdvu/pkg/mod
2018/10/31 22:28:01 3.905728ms for walk
2018/10/31 22:28:01 85.264957ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 22:28:01 107.297878ms for query []
real 0m0.203s
user 0m0.173s
sys 0m0.146s
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 22:28:01 80.869929ms for driver [.]
2018/10/31 22:28:01 80.944841ms for query []
2018/10/31 22:28:01 scanning /go/src
2018/10/31 22:28:01 scanned /go/src
2018/10/31 22:28:01 scanning /tmp/tmp.w99uuxDmKE
2018/10/31 22:28:01 scanned /tmp/tmp.w99uuxDmKE
2018/10/31 22:28:01 skipping nonexistant directory: /tmp/tmp.SFG4Iwkdvu/pkg/mod
2018/10/31 22:28:01 4.332818ms for walk
2018/10/31 22:28:01 92.126314ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 22:28:01 113.609999ms for query []
real 0m0.211s
user 0m0.173s
sys 0m0.164s
$ pushd $(mktemp -d)
/tmp/tmp.55K2mGcE3o /tmp/tmp.w99uuxDmKE
$ 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/containerd/continuity v0.0.0-20181001140422-bd77b46c8352
go: finding github.com/coreos/etcd v3.3.9+incompatible
go: finding github.com/gorilla/mux v0.0.0-20160317213430-0eeaf8392f5b
go: finding github.com/opencontainers/selinux v0.0.0-20180628160156-b6fa367ed7f5
go: finding github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f
go: finding github.com/vbatts/tar-split v0.11.0
go: finding github.com/tonistiigi/fsutil v0.0.0-20181002165410-f567071bed24
go: finding github.com/hashicorp/consul v0.5.2
go: finding github.com/golang/protobuf v1.1.0
go: finding github.com/containerd/ttrpc v0.0.0-20180920185216-2a805f718635
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/syndtr/gocapability v0.0.0-20150716010906-2c00daeb6c3b
go: finding github.com/mattn/go-shellwords v1.0.3
go: finding github.com/docker/go-units v0.3.3
go: finding github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
go: finding github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452
go: finding github.com/spf13/cobra v0.0.3
go: finding github.com/vishvananda/netlink v0.0.0-20171020171820-b2de5d10e38e
go: finding github.com/hashicorp/go-msgpack v0.0.0-20140221154404-71c2886f5a67
go: finding github.com/prometheus/client_golang v0.8.0
go: finding github.com/godbus/dbus v4.0.0+incompatible
go: finding github.com/golang/gddo v0.0.0-20180130204405-9b12a26f3fbd
go: finding github.com/pivotal-golang/clock v0.0.0-20151018222946-3fd3c1944c59
go: finding github.com/docker/libtrust v0.0.0-20150526203908-9cbd2a1374f4
go: finding github.com/containerd/cri v0.0.0-20180917182010-9f39e3289533
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/matttproud/golang_protobuf_extensions v1.0.0
go: finding github.com/opencontainers/runc v0.0.0-20181016003215-a00bf0190895
go: finding github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd
go: finding github.com/deckarep/golang-set v0.0.0-20141123011944-ef32fa3046d9
go: finding github.com/fsnotify/fsnotify v1.4.7
go: finding github.com/hashicorp/serf v0.0.0-20160317193612-598c54895cc5
go: finding github.com/sirupsen/logrus v1.0.6
go: finding github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7
go: finding github.com/miekg/dns v1.0.7
go: finding github.com/fluent/fluent-logger-golang v1.3.0
go: finding github.com/moby/buildkit v0.0.0-20181011194101-c7bb575343df
go: finding github.com/imdario/mergo v0.3.6
go: finding github.com/hashicorp/go-memdb v0.0.0-20161216180745-cb9a474f84cc
go: finding github.com/google/shlex v0.0.0-20150127133951-6f45313302b9
go: finding github.com/prometheus/client_model v0.0.0-20170216185247-6f3806018612
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/samuel/go-zookeeper v0.0.0-20150415181332-d0e0d8e11f31
go: finding github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf
go: finding github.com/go-ini/ini v1.25.4
go: finding go.etcd.io/bbolt v1.3.1-etcd.8
go: finding github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47
go: finding github.com/docker/go-events v0.0.0-20170721190031-9461782956ad
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/opentracing-contrib/go-stdlib v0.0.0-20171029140428-b1a47cfbdd75
go: finding github.com/gogo/protobuf v1.0.0
go: finding github.com/Microsoft/go-winio v0.4.11
go: finding github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3
go: finding github.com/gogo/googleapis v1.0.0
go: finding google.golang.org/api v0.0.0-20180530150455-de943baf05a0
go: finding github.com/armon/go-radix v0.0.0-20150105235045-e39d623f12e8
go: finding github.com/docker/go-metrics v0.0.0-20170502235133-d466d4f6fd96
go: finding github.com/tchap/go-patricia v2.2.6+incompatible
go: finding golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
go: finding golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: finding golang.org/x/oauth2 v0.0.0-20180529203656-ec22f46f877b
go: finding google.golang.org/genproto v0.0.0-20180523212516-694d95ba50e6
go: finding github.com/tinylib/msgp v0.0.0-20171013044219-3b556c645408
go: finding github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1
go: finding github.com/seccomp/libseccomp-golang v0.0.0-20160531183505-32f571b70023
go: finding github.com/armon/go-metrics v0.0.0-20150106224455-eb0af217e5e9
go: finding github.com/BurntSushi/toml v0.0.0-20170626110600-a368813c5e64
go: finding github.com/hashicorp/go-multierror v0.0.0-20150127051936-fcdddc395df1
go: finding github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645
go: finding github.com/kr/pty v0.0.0-20150511174710-5cf931ef8f76
go: finding github.com/inconshreveable/mousetrap v1.0.0
go: finding github.com/aws/aws-sdk-go v1.12.66
go: finding github.com/cloudflare/cfssl v0.0.0-20180323000720-5d63dbd981b5
go: finding github.com/pborman/uuid v0.0.0-20160209185913-a97ce2ca70fa
go: finding github.com/mistifyio/go-zfs v0.0.0-20160425201758-22c9b32c84eb
go: finding github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go: finding github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86
go: finding github.com/prometheus/procfs v0.0.0-20180612222113-7d6f385de8be
go: finding github.com/google/certificate-transparency-go v1.0.20
go: finding github.com/opencontainers/runtime-spec v0.0.0-20180909173843-eba862dc2470
go: finding github.com/google/go-cmp v0.2.0
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/ishidawataru/sctp v0.0.0-20180213033435-07191f837fed
go: finding github.com/opentracing/opentracing-go v0.0.0-20171003133519-1361b9cd60be
go: finding github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1
go: finding github.com/docker/libkv v0.0.0-20180912205406-458977154600
go: finding github.com/vishvananda/netns v0.0.0-20150710222425-604eaf189ee8
go: finding github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
go: finding github.com/opencontainers/go-digest v1.0.0-rc1
go: finding go.opencensus.io v0.11.0
go: finding github.com/vdemeester/shakers v0.1.0
go: finding github.com/ugorji/go v1.1.1
go: finding github.com/Microsoft/opengcs v0.3.9
go: finding golang.org/x/net v0.0.0-20180719180050-a680a1efc54d
go: finding github.com/coreos/go-semver v0.2.0
go: finding golang.org/x/sys v0.0.0-20180715085529-ac767d655b30
go: finding github.com/containerd/cgroups v0.0.0-20180515175038-5e610833b720
go: finding github.com/googleapis/gax-go v2.0.0+incompatible
go: finding github.com/RackSec/srslog v0.0.0-20161121191927-456df3a81436
go: finding github.com/Microsoft/hcsshim v0.7.9
go: finding github.com/containerd/containerd v1.2.0-rc.1
go: finding github.com/spf13/pflag v1.0.1
go: finding github.com/opencontainers/image-spec v1.0.1
go: finding github.com/docker/libnetwork v0.0.0-20181012153825-d7b61745d166
go: finding github.com/fernet/fernet-go v0.0.0-20151007213151-1b2437bc582b
go: finding golang.org/x/text v0.3.0
go: finding google.golang.org/grpc v1.12.0
go: finding gotest.tools v2.1.0+incompatible
go: finding cloud.google.com/go v0.23.0
go: downloading github.com/pkg/errors v0.8.0
go: downloading github.com/containerd/containerd v1.2.0-rc.1
go: downloading github.com/moby/buildkit v0.0.0-20181011194101-c7bb575343df
go: downloading github.com/bsphere/le_go v0.0.0-20170215134836-7a984a84b549
go: downloading github.com/docker/distribution v0.0.0-20180327202408-83389a148052
go: downloading github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78
go: downloading github.com/docker/libnetwork v0.0.0-20181012153825-d7b61745d166
go: downloading github.com/docker/go-connections v0.4.0
go: downloading github.com/opencontainers/image-spec v1.0.1
go: downloading golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2
go: downloading github.com/Microsoft/go-winio v0.4.11
go: downloading gotest.tools v2.1.0+incompatible
go: downloading golang.org/x/sys v0.0.0-20180715085529-ac767d655b30
go: downloading github.com/spf13/pflag v1.0.1
go: downloading github.com/aws/aws-sdk-go v1.12.66
go: downloading github.com/opencontainers/selinux v0.0.0-20180628160156-b6fa367ed7f5
go: downloading google.golang.org/grpc v1.12.0
go: downloading github.com/opentracing/opentracing-go v0.0.0-20171003133519-1361b9cd60be
go: downloading github.com/opencontainers/runc v0.0.0-20181016003215-a00bf0190895
go: downloading github.com/containerd/cgroups v0.0.0-20180515175038-5e610833b720
go: downloading github.com/google/go-cmp v0.2.0
go: downloading github.com/docker/swarmkit v0.0.0-20181017185945-a84c01f49091
go: downloading github.com/containerd/continuity v0.0.0-20181001140422-bd77b46c8352
go: downloading github.com/opencontainers/go-digest v1.0.0-rc1
go: downloading github.com/golang/protobuf v1.1.0
go: downloading github.com/tonistiigi/fsutil v0.0.0-20181002165410-f567071bed24
go: downloading github.com/docker/libtrust v0.0.0-20150526203908-9cbd2a1374f4
go: downloading github.com/gogo/protobuf v1.0.0
go: downloading golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: downloading github.com/RackSec/srslog v0.0.0-20161121191927-456df3a81436
go: downloading cloud.google.com/go v0.23.0
go: downloading github.com/docker/go-units v0.3.3
go: downloading golang.org/x/net v0.0.0-20180719180050-a680a1efc54d
go: downloading github.com/docker/libkv v0.0.0-20180912205406-458977154600
go: downloading github.com/prometheus/client_golang v0.8.0
go: downloading github.com/cloudflare/cfssl v0.0.0-20180323000720-5d63dbd981b5
go: downloading google.golang.org/genproto v0.0.0-20180523212516-694d95ba50e6
go: downloading github.com/hashicorp/serf v0.0.0-20160317193612-598c54895cc5
go: downloading github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1
go: downloading github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.0
go: downloading go.etcd.io/bbolt v1.3.1-etcd.8
go: downloading github.com/spf13/cobra v0.0.3
go: downloading github.com/mattn/go-shellwords v1.0.3
go: downloading github.com/BurntSushi/toml v0.0.0-20170626110600-a368813c5e64
go: downloading github.com/armon/go-metrics v0.0.0-20150106224455-eb0af217e5e9
go: downloading github.com/containerd/ttrpc v0.0.0-20180920185216-2a805f718635
go: downloading github.com/fluent/fluent-logger-golang v1.3.0
go: downloading github.com/Microsoft/hcsshim v0.7.9
go: downloading github.com/armon/go-radix v0.0.0-20150105235045-e39d623f12e8
go: downloading github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645
go: downloading github.com/golang/gddo v0.0.0-20180130204405-9b12a26f3fbd
go: downloading google.golang.org/api v0.0.0-20180530150455-de943baf05a0
go: downloading github.com/prometheus/client_model v0.0.0-20170216185247-6f3806018612
go: downloading github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd
go: downloading github.com/containerd/fifo v0.0.0-20180307165137-3d5202aec260
go: finding github.com/docker/docker/autogen/winresources/dockerd latest
go: downloading github.com/coreos/etcd v3.3.9+incompatible
go: finding github.com/go-check/check latest
go: downloading github.com/go-check/check v0.0.0-20180628173108-788fd7840127
go: downloading github.com/opencontainers/runtime-spec v0.0.0-20180909173843-eba862dc2470
go: downloading github.com/hashicorp/go-msgpack v0.0.0-20140221154404-71c2886f5a67
go: downloading github.com/tinylib/msgp v0.0.0-20171013044219-3b556c645408
go: downloading github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7
go: downloading github.com/vishvananda/netlink v0.0.0-20171020171820-b2de5d10e38e
go: downloading github.com/ishidawataru/sctp v0.0.0-20180213033435-07191f837fed
go: downloading github.com/tchap/go-patricia v2.2.6+incompatible
go: downloading github.com/docker/go-metrics v0.0.0-20170502235133-d466d4f6fd96
go: downloading golang.org/x/text v0.3.0
go: downloading github.com/hashicorp/go-memdb v0.0.0-20161216180745-cb9a474f84cc
go: downloading github.com/prometheus/procfs v0.0.0-20180612222113-7d6f385de8be
go: downloading github.com/vbatts/tar-split v0.11.0
go: downloading github.com/philhofer/fwd v0.0.0-20160129035939-98c11a7a6ec8
go: downloading github.com/docker/go-events v0.0.0-20170721190031-9461782956ad
go: downloading github.com/gorilla/mux v0.0.0-20160317213430-0eeaf8392f5b
go: downloading golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
go: downloading github.com/google/certificate-transparency-go v1.0.20
go: finding github.com/golang/glog latest
go: downloading github.com/samuel/go-zookeeper v0.0.0-20150415181332-d0e0d8e11f31
go: downloading github.com/inconshreveable/mousetrap v1.0.0
go: downloading github.com/mistifyio/go-zfs v0.0.0-20160425201758-22c9b32c84eb
go: finding github.com/Nvveen/Gotty latest
go: downloading github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5
go: finding github.com/hashicorp/go-immutable-radix v1.0.0
go: downloading github.com/hashicorp/go-immutable-radix v1.0.0
go: finding github.com/stretchr/testify/require latest
go: downloading github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: downloading github.com/hashicorp/memberlist v0.0.0-20171201184301-3d8438da9589
go: finding github.com/stretchr/testify/suite latest
go: finding github.com/stretchr/testify/assert latest
go: finding github.com/soheilhy/cmux v0.1.4
go: finding github.com/bfirsh/funker-go latest
go: downloading github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: downloading github.com/hashicorp/go-multierror v0.0.0-20150127051936-fcdddc395df1
go: downloading github.com/Microsoft/opengcs v0.3.9
go: downloading github.com/soheilhy/cmux v0.1.4
go: downloading github.com/coreos/go-semver v0.2.0
go: downloading golang.org/x/oauth2 v0.0.0-20180529203656-ec22f46f877b
go: downloading github.com/opentracing-contrib/go-stdlib v0.0.0-20171029140428-b1a47cfbdd75
go: downloading github.com/godbus/dbus v4.0.0+incompatible
go: downloading github.com/gogo/googleapis v1.0.0
go: downloading github.com/googleapis/gax-go v2.0.0+incompatible
go: downloading github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452
go: downloading github.com/vdemeester/shakers v0.1.0
go: finding github.com/stretchr/testify v1.2.2
go: downloading github.com/stretchr/testify v1.2.2
go: downloading github.com/bfirsh/funker-go v0.0.0-20161231111542-eaa0a2e06f30
go: downloading github.com/pborman/uuid v0.0.0-20160209185913-a97ce2ca70fa
go: downloading github.com/google/shlex v0.0.0-20150127133951-6f45313302b9
go: downloading github.com/vishvananda/netns v0.0.0-20150710222425-604eaf189ee8
go: downloading github.com/containerd/cri v0.0.0-20180917182010-9f39e3289533
go: downloading github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1
go: downloading github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
go: downloading github.com/fsnotify/fsnotify v1.4.7
go: downloading github.com/seccomp/libseccomp-golang v0.0.0-20160531183505-32f571b70023
go: downloading github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f
go: downloading github.com/miekg/dns v1.0.7
go: finding github.com/golang/protobuf/proto/testdata latest
go: finding github.com/satori/go.uuid v1.2.0
go: finding github.com/jonboulle/clockwork v0.1.0
go: finding github.com/phayes/permbits latest
go: downloading github.com/Graylog2/go-gelf v0.0.0-20171211094031-414364622654
go: downloading go.opencensus.io v0.11.0
go: downloading github.com/satori/go.uuid v1.2.0
go: downloading github.com/jonboulle/clockwork v0.1.0
go: downloading github.com/syndtr/gocapability v0.0.0-20150716010906-2c00daeb6c3b
go: downloading github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go: downloading github.com/hashicorp/consul v0.5.2
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding google.golang.org/appengine/urlfetch latest
go: finding github.com/xiang90/probing latest
go: downloading github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3
go: downloading github.com/sirupsen/logrus v1.0.6
go: downloading github.com/go-ini/ini v1.25.4
go: downloading github.com/kr/pty v0.0.0-20150511174710-5cf931ef8f76
go: downloading github.com/deckarep/golang-set v0.0.0-20141123011944-ef32fa3046d9
go: finding google.golang.org/appengine v1.2.0
go: finding github.com/vmihailenco/msgpack v4.0.1+incompatible
go: downloading github.com/vmihailenco/msgpack v4.0.1+incompatible
go: finding github.com/bmizerany/assert latest
go: downloading github.com/phayes/permbits v0.0.0-20180830030258-59f2482cd460
go: finding google.golang.org/appengine/socket latest
go: downloading gopkg.in/yaml.v2 v2.2.1
go: finding github.com/google/btree latest
go: finding camlistore.org/pkg/throttle latest
go: downloading github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18
go: downloading github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869
go: downloading github.com/ugorji/go v1.1.1
go: downloading google.golang.org/appengine v1.2.0
go: downloading github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47
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: finding gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2
go: finding github.com/tmc/grpc-websocket-proxy/wsproxy latest
go: finding github.com/grpc-ecosystem/grpc-gateway/utilities latest
go: finding github.com/coreos/bbolt v1.3.0
go: downloading github.com/pivotal-golang/clock v0.0.0-20151018222946-3fd3c1944c59
go: finding github.com/grpc-ecosystem/grpc-gateway/runtime latest
go: downloading github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
go: downloading gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2
go: finding github.com/golang/groupcache/lru latest
go: downloading github.com/fernet/fernet-go v0.0.0-20151007213151-1b2437bc582b
go: downloading github.com/coreos/bbolt v1.3.0
go: downloading github.com/imdario/mergo v0.3.6
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/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86
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/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf
go: finding github.com/hashicorp/hcl v1.0.0
go: finding github.com/ghodss/yaml v1.0.0
go: finding github.com/smartystreets/goconvey/convey latest
go: finding github.com/hashicorp/consul/lib latest
go: finding github.com/golang/groupcache latest
go: downloading github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff
go: finding github.com/grpc-ecosystem/grpc-gateway v1.5.1
go: downloading github.com/grpc-ecosystem/grpc-gateway v1.5.1
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/ghodss/yaml v1.0.0
go: finding github.com/onsi/ginkgo v1.6.0
go: finding github.com/onsi/gomega v1.4.2
go: finding labix.org/v2/mgo/bson latest
go: downloading github.com/onsi/ginkgo v1.6.0
go: downloading github.com/onsi/gomega v1.4.2
go: finding labix.org/v2/mgo latest
go: downloading labix.org/v2/mgo v0.0.0-20140701140051-000000000287
go: finding github.com/smartystreets/goconvey latest
go: downloading github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a
go: finding camlistore.org/pkg latest
go: finding camlistore.org latest
go: downloading camlistore.org v0.0.0-20171230002226-a5a65f0d8b22
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 github.com/davecgh/go-spew v1.1.1
go: finding golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e
go: finding golang.org/x/net v0.0.0-20180724234803-3673e40ba225
go: finding github.com/hashicorp/golang-lru v0.5.0
go: finding golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
go: finding github.com/hashicorp/go-uuid v1.0.0
go: finding github.com/hpcloud/tail v1.0.0
go: finding gopkg.in/fsnotify.v1 v1.4.7
go: finding gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
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/hashicorp/go-uuid v1.0.0
go: downloading gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: downloading github.com/hashicorp/golang-lru v0.5.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: finding github.com/hashicorp/go-rootcerts latest
go: finding github.com/hashicorp/go-cleanhttp v0.5.0
go: finding github.com/pmezard/go-difflib/difflib latest
go: finding github.com/pascaldekloe/goe/verify latest
go: finding github.com/mitchellh/mapstructure v1.1.2
go: finding github.com/kr/pretty v0.1.0
go: finding github.com/armon/go-metrics/prometheus latest
go: finding github.com/armon/go-metrics/datadog latest
go: finding github.com/armon/go-metrics latest
go: downloading github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da
go: finding gopkg.in/airbrake/gobrake.v2 v2.0.9
go: finding github.com/smartystreets/assertions latest
go: downloading github.com/hashicorp/go-cleanhttp v0.5.0
go: finding github.com/hashicorp/yamux latest
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90
go: downloading github.com/hpcloud/tail v1.0.0
go: finding github.com/armon/go-metrics/circonus latest
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading github.com/kr/pretty v0.1.0
go: finding github.com/pascaldekloe/goe latest
go: downloading github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c
go: downloading gopkg.in/fsnotify.v1 v1.4.7
go: downloading gopkg.in/airbrake/gobrake.v2 v2.0.9
go: finding github.com/gorilla/websocket v1.4.0
go: finding github.com/mitchellh/go-testing-interface v1.0.0
go: finding github.com/boltdb/bolt v1.3.1
go: finding github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/pmezard/go-difflib v1.0.0
go: finding github.com/jtolds/gls v4.2.1+incompatible
go: downloading github.com/jtolds/gls v4.2.1+incompatible
go: downloading github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d
go: downloading github.com/mitchellh/go-testing-interface v1.0.0
go: downloading github.com/gorilla/websocket v1.4.0
go: downloading github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d
go: downloading github.com/boltdb/bolt v1.3.1
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/DataDog/datadog-go/statsd latest
go: finding github.com/gopherjs/gopherjs/js 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/circonus-labs/circonusllhist v0.1.0
go: finding github.com/tv42/httpunix latest
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.w99uuxDmKE
$ 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 22:30:29 72.842575ms for driver [.]
2018/10/31 22:30:29 72.926256ms for query []
2018/10/31 22:30:29 scanning /go/src
2018/10/31 22:30:29 scanned /go/src
2018/10/31 22:30:29 scanning /tmp/tmp.w99uuxDmKE
2018/10/31 22:30:29 scanned /tmp/tmp.w99uuxDmKE
2018/10/31 22:30:29 scanning /tmp/tmp.SFG4Iwkdvu/pkg/mod
2018/10/31 22:30:29 Directory added to ignore list: /tmp/tmp.SFG4Iwkdvu/pkg/mod/cache
2018/10/31 22:30:29 scanned /tmp/tmp.SFG4Iwkdvu/pkg/mod
2018/10/31 22:30:29 40.852989ms for walk
2018/10/31 22:30:29 88.263809ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 22:30:34 4.871084765s 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/agent/exec github.com/hashicorp/consul/command/exec github.com/onsi/gomega/gexec google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test github.com/moby/buildkit/executor github.com/moby/buildkit/executor/containerdexecutor github.com/moby/buildkit/executor/oci github.com/moby/buildkit/executor/runcexecutor]
2018/10/31 22:30:34 5.018325191s for query []
real 0m5.265s
user 0m16.983s
sys 0m7.388s
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 22:30:34 77.895518ms for driver [.]
2018/10/31 22:30:34 77.995177ms for query []
2018/10/31 22:30:34 scanning /go/src
2018/10/31 22:30:35 scanned /go/src
2018/10/31 22:30:35 scanning /tmp/tmp.w99uuxDmKE
2018/10/31 22:30:35 scanned /tmp/tmp.w99uuxDmKE
2018/10/31 22:30:35 scanning /tmp/tmp.SFG4Iwkdvu/pkg/mod
2018/10/31 22:30:35 Directory added to ignore list: /tmp/tmp.SFG4Iwkdvu/pkg/mod/cache
2018/10/31 22:30:35 scanned /tmp/tmp.SFG4Iwkdvu/pkg/mod
2018/10/31 22:30:35 42.456792ms for walk
2018/10/31 22:30:35 91.744644ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 22:30:35 222.930292ms for driver [github.com/hashicorp/consul/agent/exec github.com/hashicorp/consul/command/exec github.com/docker/swarmkit/agent/exec github.com/docker/swarmkit/agent/exec/dockerapi github.com/smartystreets/goconvey/web/server/executor github.com/onsi/gomega/gexec github.com/moby/buildkit/executor 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]
2018/10/31 22:30:35 375.63024ms for query []
real 0m0.640s
user 0m0.987s
sys 0m0.498s
$ time $GOPATH/bin/goimports main.go >/dev/null
2018/10/31 22:30:35 78.401628ms for driver [.]
2018/10/31 22:30:35 78.479177ms for query []
2018/10/31 22:30:35 scanning /go/src
2018/10/31 22:30:35 scanned /go/src
2018/10/31 22:30:35 scanning /tmp/tmp.w99uuxDmKE
2018/10/31 22:30:35 scanned /tmp/tmp.w99uuxDmKE
2018/10/31 22:30:35 scanning /tmp/tmp.SFG4Iwkdvu/pkg/mod
2018/10/31 22:30:35 Directory added to ignore list: /tmp/tmp.SFG4Iwkdvu/pkg/mod/cache
2018/10/31 22:30:35 scanned /tmp/tmp.SFG4Iwkdvu/pkg/mod
2018/10/31 22:30:35 48.447881ms for walk
2018/10/31 22:30:35 92.238504ms for driver [os/exec cmd/vendor/github.com/google/pprof/internal/elfexec .]
2018/10/31 22:30:36 220.990045ms for driver [github.com/docker/swarmkit/agent/exec github.com/docker/swarmkit/agent/exec/dockerapi google.golang.org/genproto/googleapis/devtools/remoteexecution/v1test 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/moby/buildkit/executor/oci github.com/moby/buildkit/executor/containerdexecutor github.com/moby/buildkit/executor/runcexecutor github.com/onsi/gomega/gexec]
2018/10/31 22:30:36 380.50827ms for query []
=============================================
real 0m0.635s
user 0m0.957s
sys 0m0.462s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment