Fixed #165: glide update panics with --no-recursive option
Note, the --no-recursive option may be deprecated in the future.
Using --no-recursive skips generating a lockfile becuase the
complete dependency tree cannot be calculated. This is the reason
it may be deprecated in the future.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 585c017..df549d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
- Fixed #163: Was detecting std lib packages when the GOROOT was different at
runtime than compile time.
+- Fixed #165: glide update panics with --no-recursive option.
# Release 0.8.0 (2015-12-10)
diff --git a/cmd/flatten.go b/cmd/flatten.go
index ace0815..d7ec6a7 100644
--- a/cmd/flatten.go
+++ b/cmd/flatten.go
@@ -34,6 +34,7 @@
useGopath := p.Get("useGopath", false).(bool)
if skip {
+ Warn("Skipping lockfile generation because full dependency tree is not being calculated")
return conf, nil
}
packages := p.Get("packages", []string{}).([]string)
diff --git a/cmd/yaml.go b/cmd/yaml.go
index 60d3cb1..33563db 100644
--- a/cmd/yaml.go
+++ b/cmd/yaml.go
@@ -105,6 +105,11 @@
// - lockfile: A *cfg.Lockfile to render.
// - out (io.Writer): An output stream to write to. Default is os.Stdout.
func WriteLock(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt) {
+ skip := p.Get("skip", false).(bool)
+ if skip {
+ return false, nil
+ }
+
lockfile := p.Get("lockfile", nil).(*cfg.Lockfile)
Info("Writing glide.lock file")
diff --git a/glide.go b/glide.go
index 1fb4950..c55571c 100644
--- a/glide.go
+++ b/glide.go
@@ -394,9 +394,10 @@
If a dependency has a glide.yaml file, update will read that file and
update those dependencies accordingly. Those dependencies are maintained in
- a scoped vendor directory. 'vendor/foo/bar' will have its dependencies
- stored in 'vendor/foo/bar/vendor'. This behavior can be disabled with
- '--no-recursive'.
+ a the top level 'vendor/' directory. 'vendor/foo/bar' will have its
+ dependencies stored in 'vendor/'. This behavior can be disabled with
+ '--no-recursive'. When this behavior is skipped a glide.lock file is not
+ generated because the full dependency tree cannot be known.
Glide will also import Godep, GB, and GPM files as it finds them in dependencies.
It will create a glide.yaml file from the Godeps data, and then update. This
@@ -626,7 +627,8 @@
Using("filename").From("cxt:toPath").
Using("toStdout").From("cxt:toStdout").
Does(cmd.WriteLock, "lock").
- Using("lockfile").From("cxt:Lockfile")
+ Using("lockfile").From("cxt:Lockfile").
+ Using("skip").From("cxt:skipFlatten")
//Does(cmd.Rebuild, "rebuild").Using("conf").From("cxt:cfg")