Merge pull request #277 from Masterminds/fix-273
Fix 273
diff --git a/.travis.yml b/.travis.yml
index 0a42c0e..f54bf18 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,6 +4,8 @@
# against tip which has the features.
go:
- 1.5
+ - 1.6
+ - tip
# Setting sudo access to false will let Travis CI use containers rather than
# VMs to run the tests. For more details see:
diff --git a/action/ensure.go b/action/ensure.go
index 0fa529a..8d45bdd 100644
--- a/action/ensure.go
+++ b/action/ensure.go
@@ -50,13 +50,27 @@
os.Exit(1)
}
- // This works with 1.5 and >=1.6.
- cmd = exec.Command("go", "env", "GO15VENDOREXPERIMENT")
+ // Check if this is go15, which requires GO15VENDOREXPERIMENT
+ // Any release after go15 does not require that env var.
+ cmd = exec.Command("go", "version")
if out, err := cmd.CombinedOutput(); err != nil {
- msg.Err("Error looking for $GOVENDOREXPERIMENT: %s.\n", err)
+ msg.Err("Error getting version: %s.\n", err)
os.Exit(1)
- } else if strings.TrimSpace(string(out)) != "1" {
- msg.Warn("To use Glide, you must set GO15VENDOREXPERIMENT=1\n")
+ } else if strings.HasPrefix(string(out), "go version 1.5") {
+ // This works with 1.5 and 1.6.
+ cmd = exec.Command("go", "env", "GO15VENDOREXPERIMENT")
+ if out, err := cmd.CombinedOutput(); err != nil {
+ msg.Err("Error looking for $GOVENDOREXPERIMENT: %s.\n", err)
+ os.Exit(1)
+ } else if strings.TrimSpace(string(out)) != "1" {
+ msg.Err("To use Glide, you must set GO15VENDOREXPERIMENT=1")
+ os.Exit(1)
+ }
+ }
+
+ // In the case where vendoring is explicitly disabled, balk.
+ if os.Getenv("GO15VENDOREXPERIMENT") == "0" {
+ msg.Err("To use Glide, you must set GO15VENDOREXPERIMENT=1")
os.Exit(1)
}
diff --git a/dependency/resolver.go b/dependency/resolver.go
index 394c15b..d12a50c 100644
--- a/dependency/resolver.go
+++ b/dependency/resolver.go
@@ -320,7 +320,12 @@
// If one of the passed in packages does not exist in the vendor directory,
// an error is returned.
func (r *Resolver) ResolveAll(deps []*cfg.Dependency) ([]string, error) {
- queue := sliceToQueue(deps, r.VendorDir)
+ var queue *list.List
+ if r.ResolveAllFiles {
+ queue = sliceToQueue(deps, r.VendorDir)
+ } else {
+ queue = list.New()
+ }
loc, err := r.ResolveLocal(false)
if err != nil {
diff --git a/repo/vcs.go b/repo/vcs.go
index 08be85f..3ef8ff1 100644
--- a/repo/vcs.go
+++ b/repo/vcs.go
@@ -421,24 +421,25 @@
gerr := repo.Get()
// Attempt to cache the default branch
- branch := findCurrentBranch(repo)
- if branch != "" {
- // we know the default branch so we can store it in the cache
- var loc string
- if dep.Repository != "" {
- loc = dep.Repository
- } else {
- loc = "https://" + dep.Name
- }
- key, err := cacheCreateKey(loc)
- if err == nil {
- msg.Debug("Saving default branch for %s", repo.Remote())
- c := cacheRepoInfo{DefaultBranch: branch}
- err = saveCacheRepoData(key, c, home)
- if err == errCacheDisabled {
- msg.Debug("Unable to cache default branch because caching is disabled")
- } else if err != nil {
- msg.Debug("Error saving %s to cache - Error: %s", repo.Remote(), err)
+ if cache {
+ if branch := findCurrentBranch(repo); branch != "" {
+ // we know the default branch so we can store it in the cache
+ var loc string
+ if dep.Repository != "" {
+ loc = dep.Repository
+ } else {
+ loc = "https://" + dep.Name
+ }
+ key, err := cacheCreateKey(loc)
+ if err == nil {
+ msg.Debug("Saving default branch for %s", repo.Remote())
+ c := cacheRepoInfo{DefaultBranch: branch}
+ err = saveCacheRepoData(key, c, home)
+ if err == errCacheDisabled {
+ msg.Debug("Unable to cache default branch because caching is disabled")
+ } else if err != nil {
+ msg.Debug("Error saving %s to cache - Error: %s", repo.Remote(), err)
+ }
}
}
}