Masterminds / glide

Package Management for Golang
https://glide.sh
Other
8.16k stars 539 forks source link

glide does not check if 'package' is empty #1051

Open chenchun opened 5 years ago

chenchun commented 5 years ago

When updating vendor for flannel repo, https://github.com/coreos/flannel/blob/master/glide.yaml , glide outputs Update failed for : Cannot detect VCS. It took me a while to figure out what is wrong.

ramichen:flannel (ipopt) $ make update-glide
# go get -d -u github.com/Masterminds/glide
glide --debug update --strip-vendor
[DEBUG] No mirrors.yaml file exists
[INFO]  Downloading dependencies. Please wait...
[DEBUG] Locking https-golang.org-x-net
[DEBUG] Locking https-github.com-Microsoft-go-winio
[DEBUG] Locking https-golang.org-x-oauth2
[DEBUG] Locking https-github.com-joho-godotenv
[DEBUG] Locking https-k8s.io-apimachinery
[DEBUG] Locking https-google.golang.org-api
[DEBUG] Locking https-github.com-bronze1man-goStrongswanVici
[DEBUG] Locking https-k8s.io-client-go
[DEBUG] Locking https-github.com-coreos-go-systemd
[DEBUG] Locking https-github.com-aws-aws-sdk-go
[DEBUG] Locking https-
[DEBUG] Locking https-github.com-coreos-etcd
[DEBUG] Locking https-github.com-coreos-go-iptables
[DEBUG] Locking https-github.com-gorilla-mux
[DEBUG] Locking https-github.com-buger-jsonparser
[DEBUG] Setting up the cache directory
[DEBUG] Locking https-github.com-coreos-pkg
[DEBUG] Locking https-github.com-jonboulle-clockwork
[DEBUG] Locking https-github.com-Microsoft-hcsshim
[DEBUG] Locking https-github.com-vishvananda-netlink
[INFO]  --> Fetching updates for golang.org/x/net
[INFO]  --> Fetching updates for github.com/Microsoft/go-winio
[DEBUG] Locking https-github.com-golang-glog
[INFO]  --> Fetching updates for github.com/golang/glog
[INFO]  --> Fetching updates for github.com/vishvananda/netlink
[INFO]  --> Fetching updates for golang.org/x/oauth2
[INFO]  --> Fetching updates for github.com/joho/godotenv
[INFO]  --> Fetching updates for google.golang.org/api
[INFO]  --> Fetching updates for k8s.io/apimachinery
[INFO]  --> Fetching updates for github.com/bronze1man/goStrongswanVici
[INFO]  --> Fetching updates for github.com/coreos/go-systemd
[INFO]  --> Fetching updates for k8s.io/client-go
[INFO]  --> Fetching 
[WARN]  Unable to checkout 
[ERROR] Update failed for : Cannot detect VCS
[DEBUG] Unlocking https-

It turns out to be a pacakge typo in line - pacakge: github.com/sirupsen/logrus resulting in the error. I find this by printing the whole dep object and the version v1.0.6 is the clue.

ramichen:glide (master) $ git diff
diff --git a/repo/installer.go b/repo/installer.go
index 9be777c..1046ef6 100644
--- a/repo/installer.go
+++ b/repo/installer.go
@@ -526,7 +526,7 @@ func ConcurrentUpdate(deps []*cfg.Dependency, i *Installer, c *cfg.Config) error
                                        }
                                        cache.Lock(key)
                                        if err := VcsUpdate(dep, i.Force, i.Updated); err != nil {
-                                               msg.Err("Update failed for %s: %s\n", dep.Name, err)
+                                               msg.Err("Update failed for %s %#v: %s\n", dep.Name, dep, err)
                                                // Capture the error while making sure the concurrent
                                                // operations don't step on each other.
                                                lock.Lock()

[WARN]  Unable to checkout 
[ERROR] Update failed for  &cfg.Dependency{Name:"", Reference:"v1.0.6", Pin:"", Repository:"", VcsType:"", Subpackages:[]string(nil), Arch:[]string(nil), Os:[]string(nil)}: Cannot detect VCS