Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Adding UX output to dep init #1176

Merged
merged 1 commit into from
Oct 26, 2017
Merged

Adding UX output to dep init #1176

merged 1 commit into from
Oct 26, 2017

Conversation

xmattstrongx
Copy link
Contributor

What does this do / why do we need it?

Provides some output during dep init to help soften the user experience where people think the tool is hanging.

What should your reviewer look out for in this PR?

For now this WIP PR is just to start the discussion of how to bring back functionality similar to what was added before in.
https://github.com/golang/dep/pull/194/files#diff-b14a2eb16f1efbc6aa9f1ffdad724265R241

Do you need help or clarification on anything?

Yes. For now I just have something very rudimentary that displays when a new direct dep found. To regain functionality from #194 there also needs to be output when transitive deps are discovered. I believed this should be done in s.Solve(). Still digging in.

Which issue(s) does this PR fix?

fixes #1144

DEMO

dep init
HEAD is now at 6a17370 Removing godeps for testing without godep init
Cached github.com/emicklei/go-restful
Cached github.com/go-kit/kit
Cached github.com/stretchr/testify
Cached gopkg.in/mgutz/dat.v1

@carolynvs
Copy link
Collaborator

carolynvs commented Sep 27, 2017

Sorry this took so long to look at!

Remember when we chatted and were like "it seems like a 1 line fix but maybe we are missing something?" 😀 I've realized that these log messages aren't in the right spot. For a small codebase, it looks right but after running on a bigger one (e.g. run dep init --skip-tools on the kubernetes repo), or one with slow remote repository you'll see that the "is dep hanging moment" is happening later.

The log message alone won't be enough, here's a bit of context on why and what's really happening:

  • getDirectDependencies used to call sm.SyncSourceFor. This would clone and update all the direct dependencies, so adding log messages here used to make sense. Without the call to sync, however our messages about having cached a repo aren't true (since the caching happens later).
  • getDirectDependencies no longer knows the right source to pass in to sm.SyncSourceFor so we cant' just add that call back. The reason why is that there may be existing configuration from glide/govendor/etc that overrides the source for a dependency.
  • When init kicks off an import, the direct dependencies end up being cached as a side-effect:
    m, l, err := i.Import(dir, pr)
  • If there isn't anything to import, then everything is cloned during solve:
    soln, err := s.Solve()

Since the goal is to give feedback, maybe we can ignore the import pathway because dep is already printing information about each dependency as it is imported. There isn't a long period of time where the importer does work but doesn't print anything.

The problem area is when we aren't importing anything, then when we call solve during init, it first syncs everything and we get a long period of no output.

I suggest that you look into doing an explicit prefetch when we aren't doing an import (that would be when rootM is nil in the function below), making sure to follow Sam's original suggestions on concurrency which are in the original issue (and his comment linked from that issue).

func (a *rootAnalyzer) InitializeRootManifestAndLock(dir string, pr gps.ProjectRoot) (rootM *dep.Manifest, rootL *dep.Lock, err error) {
if !a.skipTools {
rootM, rootL, err = a.importManifestAndLock(dir, pr, false)
if err != nil {
return
}
}
if rootM == nil {
rootM = dep.NewManifest()
}
if rootL == nil {
rootL = &dep.Lock{}
}
return

If this is more than you have time to work on, I realize that I was really late in catching this... Just let me know and I can throw this issue back up for grabs.

@carolynvs carolynvs removed the request for review from sdboyer September 27, 2017 21:41
@xmattstrongx
Copy link
Contributor Author

@carolynvs I should have some time to look in to this deeper this weekend.

@xmattstrongx xmattstrongx force-pushed the master branch 2 times, most recently from 5dce6ce to 8bedb08 Compare October 1, 2017 18:19
@xmattstrongx
Copy link
Contributor Author

@carolynvs I have the basic functionality working. I just need to wrap with concurrency and use golang.org/x/sync/errgroup as Sam mentioned.

logger := a.ctx.Err

syncDep := func(pr gps.ProjectRoot, sm gps.SourceManager) {
message := fmt.Sprintf("Cached %s", pr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using fmt directly here and elsewhere in this file, use a.ctx.Err. This let's us capture/discard output more easily in our tests.

return strings.HasPrefix(s, prefix+"/")
}

func isStdLib(path string) bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is already defined in github.com/golang/dep/internal/gps/paths as IsStandardImportPath.

logger.Printf(message)
}

for _, v := range pkgT.Packages {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that you can usea.directDeps instead of pkgT, which is the set of repositories represented in by the import paths in pkgT. Then we don't need to pass in pkgT or deal with parsing project roots, or skipping duplicates.

@xmattstrongx
Copy link
Contributor Author

@carolynvs So Ive added the suggested changes as well as the concurrency with max 4 go routines firing the cache calls. For small projects it works well, and fast. However with the kubernetes project I am seeing a bug that I am still working to identify. It seems to fail and hang when trying to get https://bitbucket.org/bertimus9/systemstat. Ive waited for 30+ minutes and it still continues to hang. Output below showing the issue I am describing. Still looking in to it...

Cached github.com/containernetworking/cni
Cached github.com/golang/mock
Cached github.com/docker/distribution
The authenticity of host 'bitbucket.org (2401:1d80:1010::151)' can't be established.
RSA key fingerprint is SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A.
Are you sure you want to continue connecting (yes/no)? Cached bitbucket.org/ww/goautoneg
Cached github.com/influxdata/influxdb
Cached github.com/coreos/etcd
Cached github.com/docker/docker
Cached k8s.io/kubernetes


Signal received: waiting for 1 ops to complete...
Unable to cache bitbucket.org/bertimus9/systemstat - no valid source could be created:
	failed to set up sources from the following URLs:
https://bitbucket.org/bertimus9/systemstat
: remote repository at https://bitbucket.org/bertimus9/systemstat does not exist, or is inaccessible
	failed to set up sources from the following URLs:
ssh://[email protected]/bertimus9/systemstat
: remote repository at ssh://[email protected]/bertimus9/systemstat does not exist, or is inaccessible
	failed to set up sources from the following URLs:
http://bitbucket.org/bertimus9/systemstat
: context canceled
	failed to set up sources from the following URLs:
https://bitbucket.org/bertimus9/systemstat
: context canceled
	failed to set up sources from the following URLs:
ssh://[email protected]/bertimus9/systemstat
: context canceled
	failed to set up sources from the following URLs:
git://bitbucket.org/bertimus9/systemstat
: context canceled
	failed to set up sources from the following URLs:
http://bitbucket.org/bertimus9/systemstat
: context canceled
Cached bitbucket.org/bertimus9/systemstat
this SourceMgr has been released, its methods can no longer be called

@xmattstrongx
Copy link
Contributor Author

Update on the error reported above. While it is hanging if I push enter or type 'yes' then the kubernetes dep https://bitbucket.org/bertimus9/systemstat will download as expected. Is this a known bug with deps that require authenticity and require user input to continue?

Also notice at the end there is also another issue. This seems unrelated to my changes.
No versions of golang.org/x/exp met constraints:

Cached k8s.io/apiextensions-apiserver
Cached github.com/spf13/cobra
The authenticity of host 'bitbucket.org (2401:1d80:1010::151)' can't be established.
RSA key fingerprint is SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A.
Are you sure you want to continue connecting (yes/no)? Cached github.com/appc/spec
Cached k8s.io/heapster
Cached github.com/vmware/photon-controller-go-sdk
Cached github.com/influxdata/influxdb
Cached github.com/aws/aws-sdk-go
Cached github.com/docker/libnetwork
Cached github.com/coreos/etcd
Cached bitbucket.org/ww/goautoneg
Cached github.com/docker/docker
yCached k8s.io/kubernetes

Please type 'yes' or 'no': yes
Cached bitbucket.org/bertimus9/systemstat
No versions of golang.org/x/exp met constraints:
	master: Could not introduce golang.org/x/exp@master, as its subpackage golang.org/x/exp/inotify does not contain usable Go code (*build.NoGoError).. (Package is required by (root).)

@carolynvs
Copy link
Collaborator

Yes, it is expected that the ca cert is trusted for each repo. I added bitbucket.org to my trusted certs so that I don't see that prompt anymore.

As for k8's actually working with dep, it doesn't, sorry I should have mentioned that... 😞 It is just a good test for a project with lots of dependencies.

I'll take a look in a bit, but if those are the only two issues you ran into, sounds like we are in a good spot! 👍

@xmattstrongx
Copy link
Contributor Author

Awesome! The only thing I havent looked in to yet was Sams mention of golang.org/x/sync/errgroup on the issue. Any clarification on that to get me up to speed would be appreciated.

@carolynvs
Copy link
Collaborator

The reason to use an errgroup is that when an error/timeout occurs, everything is cancelled:

WithContext returns a new Group and an associated Context derived from ctx.
The derived Context is canceled the first time a function passed to Go returns a non-nil error or the first time Wait returns, whichever occurs first.

https://godoc.org/golang.org/x/sync/errgroup#WithContext

Here's an example of how to use errorgroup in the dep codebase:

g, ctx := errgroup.WithContext(context.TODO())

And here's a post that walks through how it all works:

https://www.oreilly.com/learning/run-strikingly-fast-parallel-file-searches-in-go-with-sync-errgroup

@xmattstrongx
Copy link
Contributor Author

@carolynvs Awesome! Thank you for sharing that. Glad to have learned something new and useful 😄

New output from kuberenetes

Package "bitbucket.org/bertimus9/systemstat", analyzing...
Package "github.com/Azure/go-autorest", analyzing...
Package "github.com/elazarl/goproxy", analyzing...
Package "github.com/evanphx/json-patch", analyzing...
Package "github.com/opencontainers/selinux", analyzing...
Package "github.com/prometheus/common", analyzing...
Package "golang.org/x/sys", analyzing...
Package "gopkg.in/gcfg.v1", analyzing...
Package "github.com/docker/libnetwork", analyzing...
Package "github.com/fatih/camelcase", analyzing...
Package "github.com/go-openapi/loads", analyzing...
Package "github.com/gogo/protobuf", analyzing...
Package "github.com/mvdan/xurls", analyzing...
Package "github.com/fsnotify/fsnotify", analyzing...
Package "github.com/golang/protobuf", analyzing...
Package "github.com/miekg/coredns", analyzing...
Package "github.com/storageos/go-api", analyzing...
Package "github.com/Microsoft/hcsshim", analyzing...
Package "github.com/emicklei/go-restful-swagger12", analyzing...
Package "github.com/json-iterator/go", analyzing...
Package "github.com/spf13/afero", analyzing...
Package "github.com/libopenstorage/openstorage", analyzing...
Package "github.com/rancher/go-rancher", analyzing...
Package "github.com/codedellemc/goscaleio", analyzing...
Package "github.com/coreos/go-oidc", analyzing...
Package "github.com/daviddengcn/go-colortext", analyzing...
Package "github.com/ghodss/yaml", analyzing...
Package "github.com/kardianos/osext", analyzing...
Package "github.com/peterbourgon/diskv", analyzing...
Package "github.com/google/cadvisor", analyzing...
Package "github.com/kr/pty", analyzing...
Package "golang.org/x/crypto", analyzing...
Package "github.com/xanzy/go-cloudstack", analyzing...
Package "cloud.google.com/go", analyzing...
Package "github.com/aws/aws-sdk-go", analyzing...
Package "github.com/chai2010/gettext-go", analyzing...
Package "github.com/codegangsta/negroni", analyzing...
Package "github.com/gophercloud/gophercloud", analyzing...
Package "github.com/onsi/gomega", analyzing...
Package "github.com/russross/blackfriday", analyzing...
Package "gopkg.in/yaml.v2", analyzing...
Package "github.com/armon/circbuf", analyzing...
Package "github.com/emicklei/go-restful", analyzing...
Package "github.com/opencontainers/runc", analyzing...
Package "github.com/vmware/photon-controller-go-sdk", analyzing...
Package "k8s.io/code-generator", analyzing...
Package "github.com/coreos/etcd", analyzing...
Package "github.com/go-openapi/validate", analyzing...
Package "github.com/spf13/viper", analyzing...
Package "k8s.io/apimachinery", analyzing...
Package "k8s.io/gengo", analyzing...
Package "github.com/dgrijalva/jwt-go", analyzing...
Package "github.com/influxdata/influxdb", analyzing...
Package "github.com/vishvananda/netlink", analyzing...
Package "k8s.io/kube-aggregator", analyzing...
Package "github.com/davecgh/go-spew", analyzing...
Package "github.com/spf13/pflag", analyzing...
Package "k8s.io/client-go", analyzing...
Package "bitbucket.org/ww/goautoneg", analyzing...
Package "github.com/Azure/azure-sdk-for-go", analyzing...
Package "github.com/clusterhq/flocker-go", analyzing...
Package "github.com/mitchellh/go-wordwrap", analyzing...
Package "gopkg.in/natefinch/lumberjack.v2", analyzing...
Package "vbom.ml/util", analyzing...
Package "github.com/docker/distribution", analyzing...
Package "github.com/elazarl/go-bindata-assetfs", analyzing...
Package "github.com/prometheus/client_golang", analyzing...
Package "github.com/rubiojr/go-vhd", analyzing...
Package "github.com/xyproto/simpleredis", analyzing...
Package "golang.org/x/oauth2", analyzing...
Package "github.com/PuerkitoBio/purell", analyzing...
Package "github.com/gregjones/httpcache", analyzing...
Package "github.com/renstrom/dedent", analyzing...
Package "github.com/robfig/cron", analyzing...
Package "github.com/vmware/govmomi", analyzing...
Package "k8s.io/apiserver", analyzing...
Package "golang.org/x/exp", analyzing...
Package "github.com/d2g/dhcp4", analyzing...
Package "github.com/golang/glog", analyzing...
Package "github.com/google/gofuzz", analyzing...
Package "github.com/howeyc/gopass", analyzing...
Package "github.com/lxn/win", analyzing...
Package "github.com/onsi/ginkgo", analyzing...
Package "github.com/spf13/cobra", analyzing...
Package "github.com/cloudflare/cfssl", analyzing...
Package "github.com/coreos/rkt", analyzing...
Package "github.com/pborman/uuid", analyzing...
Package "github.com/containernetworking/cni", analyzing...
Package "github.com/docker/docker", analyzing...
Package "github.com/heketi/heketi", analyzing...
Package "github.com/miekg/dns", analyzing...
Package "github.com/appc/spec", analyzing...
Package "github.com/docker/go-units", analyzing...
Package "github.com/jonboulle/clockwork", analyzing...
Package "github.com/juju/ratelimit", analyzing...
Package "k8s.io/kube-openapi", analyzing...
Package "github.com/hashicorp/golang-lru", analyzing...
Package "github.com/blang/semver", analyzing...
Package "github.com/golang/mock", analyzing...
Package "github.com/imdario/mergo", analyzing...
Package "github.com/stretchr/testify", analyzing...
Package "golang.org/x/tools", analyzing...
Package "github.com/opencontainers/go-digest", analyzing...
Package "github.com/pkg/errors", analyzing...
Package "github.com/prometheus/client_model", analyzing...
Package "github.com/coreos/go-semver", analyzing...
Package "github.com/coreos/go-systemd", analyzing...
Package "github.com/go-openapi/strfmt", analyzing...
Package "github.com/mitchellh/mapstructure", analyzing...
Package "github.com/quobyte/api", analyzing...
Package "github.com/MakeNowJust/heredoc", analyzing...
Package "github.com/mxk/go-flowrate", analyzing...
Package "github.com/square/go-jose", analyzing...
Package "k8s.io/metrics", analyzing...
Package "github.com/cpuguy83/go-md2man", analyzing...
Package "github.com/go-openapi/spec", analyzing...
Package "github.com/coreos/pkg", analyzing...
Package "github.com/docker/go-connections", analyzing...
Package "github.com/gorilla/mux", analyzing...
Package "k8s.io/api", analyzing...
Package "k8s.io/sample-apiserver", analyzing...
Package "github.com/exponent-io/jsonpath", analyzing...
Package "github.com/golang/groupcache", analyzing...
Package "google.golang.org/grpc", analyzing...
Package "k8s.io/heapster", analyzing...
Package "github.com/godbus/dbus", analyzing...
Package "github.com/googleapis/gnostic", analyzing...
Package "k8s.io/apiextensions-apiserver", analyzing...
Package "k8s.io/kubernetes", analyzing...
Package "github.com/d2g/dhcp4client", analyzing...
Package "github.com/hawkular/hawkular-client-go", analyzing...
Package "golang.org/x/net", analyzing...
Package "gopkg.in/inf.v0", analyzing...
Package "github.com/docker/spdystream", analyzing...
Package "golang.org/x/text", analyzing...
Package "google.golang.org/api", analyzing...
Package "k8s.io/utils", analyzing...
Cached golang.org/x/sys
Cached github.com/Azure/go-autorest
Cached github.com/opencontainers/selinux
Cached gopkg.in/gcfg.v1
Cached github.com/mvdan/xurls
Cached github.com/elazarl/goproxy
Cached github.com/fatih/camelcase
Cached bitbucket.org/bertimus9/systemstat
Cached github.com/miekg/coredns
Cached github.com/go-openapi/loads
Cached github.com/gogo/protobuf
Cached github.com/evanphx/json-patch
Cached github.com/libopenstorage/openstorage
Cached github.com/emicklei/go-restful-swagger12
Cached github.com/Microsoft/hcsshim
Cached github.com/fsnotify/fsnotify
Cached github.com/storageos/go-api
Cached github.com/spf13/afero
Cached github.com/kardianos/osext
Cached github.com/rancher/go-rancher
Cached github.com/codedellemc/goscaleio
Cached github.com/daviddengcn/go-colortext
Cached github.com/coreos/go-oidc
Cached github.com/ghodss/yaml
Cached github.com/chai2010/gettext-go
Cached github.com/peterbourgon/diskv
Cached github.com/golang/protobuf
Cached github.com/xanzy/go-cloudstack
Cached github.com/google/cadvisor
Cached cloud.google.com/go
Cached github.com/aws/aws-sdk-go
Cached github.com/kr/pty
Cached github.com/vmware/photon-controller-go-sdk
Cached github.com/codegangsta/negroni
Cached github.com/russross/blackfriday
Cached github.com/onsi/gomega
Cached github.com/gophercloud/gophercloud
Cached github.com/davecgh/go-spew
Cached k8s.io/code-generator
Cached github.com/prometheus/common
Cached github.com/docker/libnetwork
Cached github.com/emicklei/go-restful
Cached github.com/go-openapi/validate
Cached github.com/spf13/viper
Cached k8s.io/apimachinery
Cached gopkg.in/yaml.v2
Cached github.com/coreos/etcd
Cached golang.org/x/crypto
Cached github.com/elazarl/go-bindata-assetfs
Cached github.com/opencontainers/runc
Cached github.com/spf13/pflag
Cached k8s.io/gengo
Cached github.com/dgrijalva/jwt-go
Cached k8s.io/client-go
Cached github.com/Azure/azure-sdk-for-go
Cached github.com/clusterhq/flocker-go
Cached bitbucket.org/ww/goautoneg
Cached gopkg.in/natefinch/lumberjack.v2
Cached vbom.ml/util
Cached github.com/mitchellh/go-wordwrap
Cached golang.org/x/exp
Cached github.com/docker/distribution
Cached github.com/prometheus/client_golang
Cached github.com/rubiojr/go-vhd
Cached github.com/json-iterator/go
Cached golang.org/x/oauth2
Cached github.com/PuerkitoBio/purell
Cached github.com/gregjones/httpcache
Cached github.com/xyproto/simpleredis
Cached github.com/influxdata/influxdb
Cached github.com/robfig/cron
Cached github.com/renstrom/dedent
Cached github.com/vmware/govmomi
Cached github.com/vishvananda/netlink
Cached k8s.io/apiserver
Cached github.com/jonboulle/clockwork
Cached github.com/heketi/heketi
Cached github.com/miekg/dns
Cached github.com/docker/go-units
Cached github.com/appc/spec
Cached github.com/golang/mock
Cached github.com/docker/docker
Cached github.com/juju/ratelimit
Cached k8s.io/kube-openapi
Cached github.com/hashicorp/golang-lru
Cached github.com/blang/semver
Cached github.com/prometheus/client_model
Cached github.com/imdario/mergo
Cached golang.org/x/tools
Cached github.com/stretchr/testify
Cached github.com/opencontainers/go-digest
Cached github.com/mitchellh/mapstructure
Cached github.com/coreos/go-semver
Cached github.com/armon/circbuf
Cached github.com/coreos/go-systemd
Cached github.com/go-openapi/strfmt
Cached github.com/lxn/win
Cached github.com/d2g/dhcp4
Cached github.com/golang/glog
Cached k8s.io/kube-aggregator
Cached github.com/containernetworking/cni
Cached github.com/google/gofuzz
Cached github.com/howeyc/gopass
Cached github.com/cloudflare/cfssl
Cached github.com/spf13/cobra
Cached github.com/pkg/errors
Cached k8s.io/api
Cached k8s.io/metrics
Cached github.com/cpuguy83/go-md2man
Cached github.com/square/go-jose
Cached github.com/go-openapi/spec
Cached github.com/coreos/pkg
Cached github.com/gorilla/mux
Cached github.com/docker/go-connections
Cached github.com/onsi/ginkgo
Cached github.com/mxk/go-flowrate
Cached k8s.io/utils
Cached gopkg.in/inf.v0
Cached github.com/pborman/uuid
Cached github.com/hawkular/hawkular-client-go
Cached golang.org/x/net
Cached k8s.io/sample-apiserver
Cached github.com/exponent-io/jsonpath
Cached github.com/golang/groupcache
Cached google.golang.org/grpc
Cached github.com/MakeNowJust/heredoc
Cached github.com/godbus/dbus
Cached github.com/d2g/dhcp4client
Cached golang.org/x/text
Cached google.golang.org/api
Cached github.com/googleapis/gnostic
Cached github.com/docker/spdystream
Cached k8s.io/heapster
Cached github.com/quobyte/api
Cached k8s.io/apiextensions-apiserver
Cached github.com/coreos/rkt
Cached k8s.io/kubernetes
Successfully cached all deps.
No versions of golang.org/x/exp met constraints:
	master: Could not introduce golang.org/x/exp@master, as its subpackage golang.org/x/exp/inotify does not contain usable Go code (*build.NoGoError).. (Package is required by (root).)

@xmattstrongx xmattstrongx changed the title WIP Adding UX output to dep init Adding UX output to dep init Oct 9, 2017
"github.com/golang/dep/internal/importers"
)

const concurrency = 4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this definition into cacheDeps. If we end up needing it in more places later, we can extract it out then.

@@ -45,6 +52,9 @@ func (a *rootAnalyzer) InitializeRootManifestAndLock(dir string, pr gps.ProjectR

if rootM == nil {
rootM = dep.NewManifest()
if err := a.cacheDeps(pr); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a comment that explains why we are doing this right here. 😀

// Since we didn't find anything to import, dep's cache is empty.
// We are prefetching dependencies and logging so that the subsequent solve step doesn't spend a long time retrieving dependencies without feedback for the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized I forgot to push the code with this comment. Will add tonight.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comment


for ip := range a.directDeps {
logger.Printf("Package %q, analyzing...", ip)
if paths.IsStandardImportPath(ip) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this check

if paths.IsStandardImportPath(ip) {
continue
}
if hasImportPathPrefix(ip, string(pr)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this check

continue
}

pr, err := a.sm.DeduceProjectRoot(ip)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So removing this guy seems to be breaking the underlying call SyncSourceFor called by the new syncDep func. Im still investigating

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ive been trying to use type conversion to pass a "gps.ProjectRoot" without the call to DeduceProjectRoot.
err := syncDep(gps.ProjectRoot(ip), a.sm)

Doing this causes one of the deps to cache over and over again and then end the entire process. Digging in to this now.

Cached github.com/docker/spdystream
Cached github.com/fsnotify/fsnotify
Cached github.com/fsnotify/fsnotify
Cached github.com/xanzy/go-cloudstack
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Cached github.com/spf13/cobra
Successfully cached all deps.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd, that is the right thing to do to cast to a ProjectRoot. I wonder if that's really due to other changes you've made to the code?

I really wish that when I had refactored the importers that I had fixed the type on directDeps and used gps.ProjectRoot instead of string. 😀

return err
}

if _, ok := deps[pr]; ok {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this check

return nil
}

for ip := range a.directDeps {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a.directDeps is a unique set of external project roots. So you don't need to track if they have been evaluated already, check if they are stdlib imports, or deduce the root again.

Check out

func getDirectDependencies(sm gps.SourceManager, p *dep.Project) (pkgtree.PackageTree, map[string]bool, error) {
to see how its calculated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. Thanks for clarifying. Can definitely remove all of these extra checks then!


deps[pr] = true
}
if err := g.Wait(); err == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any handling for when err is not nil?

return nil
}

func hasImportPathPrefix(s, prefix string) bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this


g.Go(func() error {
select {
case sem <- struct{}{}:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize now that the existing usage of using errgroup in dep was not the best/canonical example to have pointed you to.

I would rather not use this extra sem channel to handle bounded parallelism and instead use the pattern from the errgroup documentation:

https://godoc.org/golang.org/x/sync/errgroup#example-Group--Pipeline

In that example, they start a fixed number of goroutines instead of a goroutine per work item (look for numDigesters), and range over a channel of input values (in our case that would be the project roots).

@xmattstrongx
Copy link
Contributor Author

@carolynvs Added in concurrency changes for errGroup.

Demo of latest output when calling dep init on kubernetes.

$ dep init --skip-tools
HEAD is now at cd37a28fa5 Update CHANGELOG.md for v1.5.8.
Package "github.com/cpuguy83/go-md2man", analyzing...
Package "github.com/ghodss/yaml", analyzing...
Package "github.com/influxdata/influxdb", analyzing...
Package "github.com/spf13/viper", analyzing...
Package "google.golang.org/api", analyzing...
Cached github.com/cpuguy83/go-md2man
Package "github.com/golang/protobuf", analyzing...
Cached github.com/ghodss/yaml
Package "github.com/google/gofuzz", analyzing...
Cached github.com/spf13/viper
Package "github.com/imdario/mergo", analyzing...
Cached github.com/influxdata/influxdb
Package "github.com/prometheus/client_golang", analyzing...
Cached google.golang.org/api
Package "golang.org/x/sys", analyzing...
Cached github.com/google/gofuzz
Package "github.com/godbus/dbus", analyzing...
Cached github.com/golang/protobuf
Package "github.com/gregjones/httpcache", analyzing...
Cached github.com/imdario/mergo
Package "github.com/Azure/go-autorest", analyzing...
Cached golang.org/x/sys
Package "github.com/armon/circbuf", analyzing...
Cached github.com/prometheus/client_golang
Package "github.com/coreos/pkg", analyzing...
Cached github.com/godbus/dbus
Package "github.com/d2g/dhcp4client", analyzing...
Cached github.com/armon/circbuf
Package "github.com/docker/libnetwork", analyzing...
Cached github.com/gregjones/httpcache
Package "github.com/fsnotify/fsnotify", analyzing...
Cached github.com/coreos/pkg
Package "github.com/kr/pty", analyzing...
Cached github.com/Azure/go-autorest
Package "github.com/quobyte/api", analyzing...
Cached github.com/d2g/dhcp4client
Package "github.com/spf13/cobra", analyzing...
Cached github.com/kr/pty
Package "golang.org/x/crypto", analyzing...
Cached github.com/fsnotify/fsnotify
Package "gopkg.in/inf.v0", analyzing...
Cached github.com/docker/libnetwork
Package "k8s.io/apimachinery", analyzing...
Cached github.com/quobyte/api
Package "github.com/aws/aws-sdk-go", analyzing...
Cached golang.org/x/crypto
Package "github.com/russross/blackfriday", analyzing...
Cached github.com/spf13/cobra
Package "k8s.io/apiextensions-apiserver", analyzing...
Cached gopkg.in/inf.v0
Package "github.com/daviddengcn/go-colortext", analyzing...
Cached k8s.io/apimachinery
Package "github.com/docker/go-connections", analyzing...
Cached k8s.io/apiextensions-apiserver
Package "github.com/elazarl/go-bindata-assetfs", analyzing...
Cached github.com/russross/blackfriday
Package "github.com/stretchr/testify", analyzing...
Cached github.com/aws/aws-sdk-go
Package "github.com/clusterhq/flocker-go", analyzing...
Cached github.com/daviddengcn/go-colortext
Package "github.com/docker/spdystream", analyzing...
Cached github.com/elazarl/go-bindata-assetfs
Package "github.com/hawkular/hawkular-client-go", analyzing...
Cached github.com/docker/go-connections
Package "k8s.io/sample-apiserver", analyzing...
Cached github.com/stretchr/testify
Package "github.com/opencontainers/runc", analyzing...
Cached github.com/clusterhq/flocker-go
Package "github.com/pkg/errors", analyzing...
Cached github.com/docker/spdystream
Package "github.com/containernetworking/cni", analyzing...
Cached github.com/hawkular/hawkular-client-go
Package "github.com/elazarl/goproxy", analyzing...
Cached k8s.io/sample-apiserver
Package "github.com/emicklei/go-restful-swagger12", analyzing...
Cached github.com/opencontainers/runc
Package "github.com/google/cadvisor", analyzing...
Cached github.com/pkg/errors
Package "github.com/googleapis/gnostic", analyzing...
Cached github.com/containernetworking/cni
Package "github.com/libopenstorage/openstorage", analyzing...
Cached github.com/elazarl/goproxy
Package "github.com/square/go-jose", analyzing...
Cached github.com/emicklei/go-restful-swagger12
Package "golang.org/x/exp", analyzing...
Cached github.com/googleapis/gnostic
Package "k8s.io/utils", analyzing...
Cached github.com/google/cadvisor
Package "vbom.ml/util", analyzing...
Cached github.com/libopenstorage/openstorage
Package "github.com/PuerkitoBio/purell", analyzing...
Cached github.com/square/go-jose
Package "github.com/go-openapi/strfmt", analyzing...
Cached golang.org/x/exp
Package "github.com/mitchellh/go-wordwrap", analyzing...
Cached vbom.ml/util
Package "github.com/mxk/go-flowrate", analyzing...
Cached k8s.io/utils
Package "github.com/opencontainers/selinux", analyzing...
Cached github.com/PuerkitoBio/purell
Package "google.golang.org/grpc", analyzing...
Cached github.com/go-openapi/strfmt
Package "github.com/jonboulle/clockwork", analyzing...
Cached github.com/mitchellh/go-wordwrap
Package "github.com/json-iterator/go", analyzing...
Cached github.com/mxk/go-flowrate
Package "github.com/rubiojr/go-vhd", analyzing...
Cached github.com/opencontainers/selinux
Package "golang.org/x/oauth2", analyzing...
Cached github.com/jonboulle/clockwork
Package "gopkg.in/yaml.v2", analyzing...
Cached github.com/json-iterator/go
Package "k8s.io/kubernetes", analyzing...
Cached google.golang.org/grpc
Package "github.com/cloudflare/cfssl", analyzing...
Cached github.com/rubiojr/go-vhd
Package "github.com/codegangsta/negroni", analyzing...
Cached golang.org/x/oauth2
Package "github.com/d2g/dhcp4", analyzing...
Cached gopkg.in/yaml.v2
Package "github.com/gophercloud/gophercloud", analyzing...
Cached github.com/cloudflare/cfssl
Package "github.com/prometheus/client_model", analyzing...
Cached github.com/codegangsta/negroni
Package "k8s.io/kube-openapi", analyzing...
Cached github.com/d2g/dhcp4
Package "github.com/MakeNowJust/heredoc", analyzing...
Cached github.com/prometheus/client_model
Package "github.com/fatih/camelcase", analyzing...
Cached github.com/gophercloud/gophercloud
Package "github.com/pborman/uuid", analyzing...
Cached k8s.io/kube-openapi
Package "github.com/vishvananda/netlink", analyzing...
Cached github.com/MakeNowJust/heredoc
Package "k8s.io/client-go", analyzing...
Cached github.com/fatih/camelcase
Package "github.com/coreos/etcd", analyzing...
Cached github.com/pborman/uuid
Package "github.com/dgrijalva/jwt-go", analyzing...
Cached github.com/vishvananda/netlink
Package "github.com/go-openapi/spec", analyzing...
Cached k8s.io/client-go
Package "github.com/miekg/coredns", analyzing...
Cached github.com/dgrijalva/jwt-go
Package "k8s.io/metrics", analyzing...
Cached github.com/go-openapi/spec
Package "github.com/howeyc/gopass", analyzing...
Cached github.com/coreos/etcd
Package "github.com/vmware/photon-controller-go-sdk", analyzing...
Cached k8s.io/metrics
Package "k8s.io/kube-aggregator", analyzing...
Cached github.com/howeyc/gopass
Package "github.com/coreos/go-semver", analyzing...
Cached github.com/miekg/coredns
Package "github.com/exponent-io/jsonpath", analyzing...
Cached k8s.io/kube-aggregator
Package "github.com/onsi/ginkgo", analyzing...
Cached github.com/coreos/go-semver
Package "k8s.io/gengo", analyzing...
Cached github.com/vmware/photon-controller-go-sdk
Package "github.com/Azure/azure-sdk-for-go", analyzing...
Cached github.com/exponent-io/jsonpath
Package "github.com/appc/spec", analyzing...
Cached github.com/onsi/ginkgo
Package "github.com/golang/mock", analyzing...
Cached k8s.io/gengo
Package "github.com/lxn/win", analyzing...
Cached github.com/Azure/azure-sdk-for-go
Package "github.com/mvdan/xurls", analyzing...
Cached github.com/appc/spec
Package "gopkg.in/gcfg.v1", analyzing...
Cached github.com/golang/mock
Package "github.com/codedellemc/goscaleio", analyzing...
Cached github.com/lxn/win
Package "github.com/go-openapi/loads", analyzing...
Cached gopkg.in/gcfg.v1
Package "github.com/golang/groupcache", analyzing...
Cached github.com/mvdan/xurls
Package "github.com/opencontainers/go-digest", analyzing...
Cached github.com/codedellemc/goscaleio
Package "github.com/vmware/govmomi", analyzing...
Cached github.com/go-openapi/loads
Package "golang.org/x/net", analyzing...
Cached github.com/golang/groupcache
Package "github.com/coreos/go-oidc", analyzing...
Cached github.com/opencontainers/go-digest
Package "github.com/prometheus/common", analyzing...
Cached golang.org/x/net
Package "golang.org/x/tools", analyzing...
Cached github.com/coreos/go-oidc
Package "k8s.io/heapster", analyzing...
Cached github.com/vmware/govmomi
Package "github.com/docker/distribution", analyzing...
Cached github.com/prometheus/common
Package "github.com/evanphx/json-patch", analyzing...
Cached golang.org/x/tools
Package "github.com/spf13/pflag", analyzing...
Cached k8s.io/heapster
Package "k8s.io/code-generator", analyzing...
Cached github.com/evanphx/json-patch
Package "github.com/gogo/protobuf", analyzing...
Cached k8s.io/kubernetes
Package "github.com/golang/glog", analyzing...
Cached github.com/spf13/pflag
Package "github.com/peterbourgon/diskv", analyzing...
Cached github.com/docker/distribution
Package "golang.org/x/text", analyzing...
Cached k8s.io/code-generator
Package "github.com/Microsoft/hcsshim", analyzing...
Cached github.com/gogo/protobuf
Package "github.com/davecgh/go-spew", analyzing...
Cached github.com/peterbourgon/diskv
Package "github.com/emicklei/go-restful", analyzing...
Cached github.com/golang/glog
Package "github.com/miekg/dns", analyzing...
Cached golang.org/x/text
Package "github.com/mitchellh/mapstructure", analyzing...
Cached github.com/Microsoft/hcsshim
Package "github.com/robfig/cron", analyzing...
Cached github.com/davecgh/go-spew
Package "gopkg.in/natefinch/lumberjack.v2", analyzing...
Cached github.com/emicklei/go-restful
Package "github.com/coreos/go-systemd", analyzing...
Cached github.com/miekg/dns
Package "github.com/coreos/rkt", analyzing...
Cached github.com/mitchellh/mapstructure
Package "github.com/juju/ratelimit", analyzing...
Cached github.com/robfig/cron
Package "github.com/rancher/go-rancher", analyzing...
Cached gopkg.in/natefinch/lumberjack.v2
Package "github.com/renstrom/dedent", analyzing...
Cached github.com/coreos/go-systemd
Package "github.com/xanzy/go-cloudstack", analyzing...
Cached github.com/juju/ratelimit
Package "github.com/xyproto/simpleredis", analyzing...
Cached github.com/rancher/go-rancher
Package "github.com/blang/semver", analyzing...
Cached github.com/renstrom/dedent
Package "k8s.io/api", analyzing...
Cached github.com/xanzy/go-cloudstack
Package "github.com/storageos/go-api", analyzing...
Cached github.com/coreos/rkt
Package "github.com/onsi/gomega", analyzing...
Cached github.com/xyproto/simpleredis
Package "bitbucket.org/bertimus9/systemstat", analyzing...
Cached github.com/blang/semver
Package "bitbucket.org/ww/goautoneg", analyzing...
Cached k8s.io/api
Package "github.com/docker/go-units", analyzing...
Cached github.com/storageos/go-api
Package "github.com/go-openapi/validate", analyzing...
Cached github.com/onsi/gomega
Package "github.com/gorilla/mux", analyzing...
Cached github.com/docker/go-units
Package "github.com/kardianos/osext", analyzing...
Cached github.com/go-openapi/validate
Package "github.com/docker/docker", analyzing...
Cached github.com/gorilla/mux
Package "github.com/hashicorp/golang-lru", analyzing...
Cached github.com/kardianos/osext
Package "github.com/spf13/afero", analyzing...
Cached bitbucket.org/ww/goautoneg
Package "k8s.io/apiserver", analyzing...
Cached github.com/hashicorp/golang-lru
Package "cloud.google.com/go", analyzing...
Cached github.com/spf13/afero
Package "github.com/chai2010/gettext-go", analyzing...
Cached bitbucket.org/bertimus9/systemstat
Package "github.com/heketi/heketi", analyzing...
Cached k8s.io/apiserver
Cached github.com/chai2010/gettext-go
Cached cloud.google.com/go
Cached github.com/heketi/heketi
Cached github.com/docker/docker
Successfully cached all deps.
No versions of golang.org/x/exp met constraints:
	master: Could not introduce golang.org/x/exp@master, as its subpackage golang.org/x/exp/inotify does not contain usable Go code (*build.NoGoError).. (Package is required by (root).)

@xmattstrongx xmattstrongx force-pushed the master branch 2 times, most recently from db0b31c to 443f6f0 Compare October 20, 2017 13:37
Copy link
Collaborator

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 👍

I have just some very minor changes, everything is functionally correct.

defer close(deps)
for ip := range a.directDeps {
logger.Printf("Package %q, analyzing...", ip)
pr, err := a.sm.DeduceProjectRoot(ip)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directDeps is a map of project roots (see below for how it is populated), so you can change the for loop to for pr := range a.directDeps, and remove the call to DeduceProjectRoot.

dep/cmd/dep/init.go

Lines 238 to 242 in bf8f295

pr, err := sm.DeduceProjectRoot(ip)
if err != nil {
return pkgtree.PackageTree{}, nil, err
}
directDeps[string(pr)] = true

return nil
})

go func() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The godoc example used this goroutine with g.Wait() to ensure that they closed the output channel when everything was done (or there was an error). Since we aren't using that, I believe 107-109 can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct. nice catch. This was leftover cruft from when I was working out some bugs in my concurrency

logger.Printf("Unable to cache %s - %s", pr, err)
return err
}
logger.Printf("Cached %s", pr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the output, I think it would be clearer if we cut down a bit on how much we are printing. Let's remove this print statement so that we are only logging when we start caching a package, and when the caching fails.

So the output would look more like this:

Caching package github.com/example/A
Caching package github.com/example/B
Caching package github.com/example/C
Successfully cached all deps.

g.Go(func() error {
defer close(deps)
for ip := range a.directDeps {
logger.Printf("Package %q, analyzing...", ip)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to Caching package %q because we aren't actually analyzing anything.

@xmattstrongx
Copy link
Contributor Author

@carolynvs comments address. New output after changes:

git add --all && git reset --hard && dep init --skip-tools
HEAD is now at cd37a28fa5 Update CHANGELOG.md for v1.5.8.
Caching package "github.com/square/go-jose"
Caching package "github.com/vmware/photon-controller-go-sdk"
Caching package "golang.org/x/text"
Caching package "vbom.ml/util"
Caching package "k8s.io/kube-aggregator"
Caching package "k8s.io/kube-openapi"
Caching package "github.com/Azure/azure-sdk-for-go"
Caching package "github.com/coreos/go-systemd"
Caching package "github.com/google/cadvisor"
Caching package "github.com/rancher/go-rancher"
Caching package "github.com/miekg/dns"
Caching package "github.com/onsi/ginkgo"
Caching package "k8s.io/apimachinery"
Caching package "k8s.io/metrics"
Caching package "github.com/daviddengcn/go-colortext"
Caching package "github.com/emicklei/go-restful"
Caching package "github.com/heketi/heketi"
Caching package "github.com/jonboulle/clockwork"
Caching package "github.com/docker/spdystream"
Caching package "github.com/stretchr/testify"
Caching package "github.com/aws/aws-sdk-go"
Caching package "github.com/spf13/afero"
Caching package "k8s.io/client-go"
Caching package "github.com/howeyc/gopass"
Caching package "github.com/robfig/cron"
Caching package "github.com/spf13/cobra"
Caching package "gopkg.in/gcfg.v1"
Caching package "github.com/pborman/uuid"
Caching package "google.golang.org/api"
Caching package "gopkg.in/yaml.v2"
Caching package "github.com/PuerkitoBio/purell"
Caching package "github.com/emicklei/go-restful-swagger12"
Caching package "github.com/golang/mock"
Caching package "github.com/mitchellh/mapstructure"
Caching package "k8s.io/apiextensions-apiserver"
Caching package "github.com/coreos/rkt"
Caching package "github.com/go-openapi/loads"
Caching package "github.com/spf13/viper"
Caching package "github.com/vmware/govmomi"
Caching package "github.com/Microsoft/hcsshim"
Caching package "github.com/d2g/dhcp4"
Caching package "github.com/fsnotify/fsnotify"
Caching package "gopkg.in/inf.v0"
Caching package "github.com/gorilla/mux"
Caching package "github.com/vishvananda/netlink"
Caching package "github.com/pkg/errors"
Caching package "github.com/prometheus/client_golang"
Caching package "github.com/prometheus/client_model"
Caching package "github.com/docker/go-units"
Caching package "github.com/elazarl/goproxy"
Caching package "github.com/golang/glog"
Caching package "github.com/json-iterator/go"
Caching package "github.com/xyproto/simpleredis"
Caching package "google.golang.org/grpc"
Caching package "github.com/d2g/dhcp4client"
Caching package "github.com/golang/groupcache"
Caching package "github.com/google/gofuzz"
Caching package "github.com/rubiojr/go-vhd"
Caching package "github.com/googleapis/gnostic"
Caching package "github.com/onsi/gomega"
Caching package "github.com/renstrom/dedent"
Caching package "github.com/codedellemc/goscaleio"
Caching package "github.com/go-openapi/validate"
Caching package "github.com/juju/ratelimit"
Caching package "github.com/storageos/go-api"
Caching package "golang.org/x/net"
Caching package "github.com/chai2010/gettext-go"
Caching package "github.com/coreos/etcd"
Caching package "github.com/miekg/coredns"
Caching package "github.com/mvdan/xurls"
Caching package "github.com/imdario/mergo"
Caching package "github.com/libopenstorage/openstorage"
Caching package "github.com/hawkular/hawkular-client-go"
Caching package "github.com/kr/pty"
Caching package "github.com/lxn/win"
Caching package "golang.org/x/crypto"
Caching package "github.com/dgrijalva/jwt-go"
Caching package "github.com/exponent-io/jsonpath"
Caching package "github.com/fatih/camelcase"
Caching package "github.com/hashicorp/golang-lru"
Caching package "gopkg.in/natefinch/lumberjack.v2"
Caching package "k8s.io/heapster"
Caching package "github.com/MakeNowJust/heredoc"
Caching package "github.com/containernetworking/cni"
Caching package "github.com/coreos/go-semver"
Caching package "github.com/godbus/dbus"
Caching package "github.com/armon/circbuf"
Caching package "github.com/coreos/go-oidc"
Caching package "k8s.io/apiserver"
Caching package "k8s.io/utils"
Caching package "github.com/mxk/go-flowrate"
Caching package "github.com/russross/blackfriday"
Caching package "github.com/appc/spec"
Caching package "github.com/gregjones/httpcache"
Caching package "github.com/kardianos/osext"
Caching package "github.com/opencontainers/selinux"
Caching package "github.com/quobyte/api"
Caching package "k8s.io/api"
Caching package "github.com/cloudflare/cfssl"
Caching package "github.com/codegangsta/negroni"
Caching package "github.com/cpuguy83/go-md2man"
Caching package "github.com/docker/libnetwork"
Caching package "k8s.io/gengo"
Caching package "k8s.io/sample-apiserver"
Caching package "bitbucket.org/ww/goautoneg"
Caching package "golang.org/x/oauth2"
Caching package "golang.org/x/sys"
Caching package "k8s.io/kubernetes"
Caching package "github.com/docker/go-connections"
Caching package "github.com/opencontainers/go-digest"
Caching package "github.com/golang/protobuf"
Caching package "github.com/opencontainers/runc"
Caching package "k8s.io/code-generator"
Caching package "github.com/Azure/go-autorest"
Caching package "github.com/docker/distribution"
Caching package "github.com/go-openapi/spec"
Caching package "github.com/gogo/protobuf"
Caching package "github.com/coreos/pkg"
Caching package "github.com/evanphx/json-patch"
Caching package "github.com/ghodss/yaml"
Caching package "golang.org/x/tools"
Caching package "bitbucket.org/bertimus9/systemstat"
Caching package "cloud.google.com/go"
Caching package "github.com/peterbourgon/diskv"
Caching package "github.com/prometheus/common"
Caching package "github.com/blang/semver"
Caching package "github.com/clusterhq/flocker-go"
Caching package "github.com/elazarl/go-bindata-assetfs"
Caching package "github.com/davecgh/go-spew"
Caching package "github.com/docker/docker"
Caching package "github.com/influxdata/influxdb"
Caching package "golang.org/x/exp"
Caching package "github.com/go-openapi/strfmt"
Caching package "github.com/gophercloud/gophercloud"
Caching package "github.com/spf13/pflag"
Caching package "github.com/xanzy/go-cloudstack"
Caching package "github.com/mitchellh/go-wordwrap"
Successfully cached all deps.
No versions of golang.org/x/exp met constraints:
	master: Could not introduce golang.org/x/exp@master, as its subpackage golang.org/x/exp/inotify does not contain usable Go code (*build.NoGoError).. Package is required by:
	(root)
	github.com/google/[email protected]

@carolynvs
Copy link
Collaborator

Yay! Thank you for adding this, it should really help with the "wtf is dep doing?!" moments. 🎉 💖

@carolynvs carolynvs merged commit 43474dd into golang:master Oct 26, 2017
carolynvs added a commit to carolynvs/dep that referenced this pull request Oct 26, 2017
carolynvs added a commit to carolynvs/dep that referenced this pull request Oct 26, 2017
carolynvs added a commit to carolynvs/dep that referenced this pull request Oct 26, 2017
carolynvs added a commit to carolynvs/dep that referenced this pull request Oct 26, 2017
carolynvs added a commit that referenced this pull request Oct 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefetch direct dependencies during init
3 participants