Merging from master
diff --git a/README.md b/README.md index ec6f5af..566bd30 100644 --- a/README.md +++ b/README.md
@@ -95,8 +95,9 @@ 1. Clone this repository into `$GOPATH/src/github.com/Masterminds/glide` and change directory into it -2. Ensure that the environment variable GO15VENDOREXPERIMENT is set, for - example by running `export GO15VENDOREXPERIMENT=1` +2. If you are using Go 1.5 ensure the environment variable GO15VENDOREXPERIMENT is set, for + example by running `export GO15VENDOREXPERIMENT=1`. In Go 1.6 it is enabled by default and + in Go 1.7 it is always enabled without the ability to turn it off. 3. Run `make build` This will leave you with `./glide`, which you can put in your `$PATH` if
diff --git a/action/create.go b/action/create.go index d655888..fa72e6b 100644 --- a/action/create.go +++ b/action/create.go
@@ -125,7 +125,7 @@ n := strings.TrimPrefix(pa, vpath) root, subpkg := util.NormalizeName(n) - if !config.HasDependency(root) { + if !config.HasDependency(root) && root != config.Name { count++ d := deps.Get(root) if d == nil { @@ -147,7 +147,7 @@ } config.Imports = append(config.Imports, d) - } else { + } else if config.HasDependency(root) { if len(subpkg) > 0 { subpkg = strings.TrimPrefix(subpkg, "/") d := config.Imports.Get(root)
diff --git a/dependency/resolver.go b/dependency/resolver.go index 92e10cb..300ca4d 100644 --- a/dependency/resolver.go +++ b/dependency/resolver.go
@@ -166,6 +166,13 @@ if err != nil { return nil, err } + + basedir, err = checkForBasedirSymlink(basedir) + + if err != nil { + return nil, err + } + vdir := filepath.Join(basedir, "vendor") buildContext, err := util.GetBuildContext() @@ -941,3 +948,20 @@ return true } + +// checkForBasedirSymlink checks to see if the given basedir is actually a +// symlink. In the case that it is a symlink, the symlink is read and returned. +// If the basedir is not a symlink, the provided basedir argument is simply +// returned back to the caller. +func checkForBasedirSymlink(basedir string) (string, error) { + fi, err := os.Lstat(basedir) + if err != nil { + return "", err + } + + if fi.Mode()&os.ModeSymlink != 0 { + return os.Readlink(basedir) + } + + return basedir, nil +}
diff --git a/glide.go b/glide.go index a85622c..2e01e1c 100644 --- a/glide.go +++ b/glide.go
@@ -233,7 +233,7 @@ }, cli.BoolFlag{ Name: "strip-vcs, s", - Usage: "Removes version control metada (e.g, .git directory) from the vendor folder.", + Usage: "Removes version control metadata (e.g, .git directory) from the vendor folder.", }, cli.BoolFlag{ Name: "strip-vendor, v", @@ -439,7 +439,7 @@ }, cli.BoolFlag{ Name: "strip-vcs, s", - Usage: "Removes version control metada (e.g, .git directory) from the vendor folder.", + Usage: "Removes version control metadata (e.g, .git directory) from the vendor folder.", }, cli.BoolFlag{ Name: "strip-vendor, v", @@ -458,7 +458,7 @@ installer.UseCacheGopath = c.Bool("cache-gopath") installer.UpdateVendored = c.Bool("update-vendored") installer.Home = c.GlobalString("home") - installer.DeleteUnused = c.Bool("deleteOptIn") + installer.DeleteUnused = c.Bool("delete") action.Install(installer, c.Bool("strip-vcs"), c.Bool("strip-vendor")) }, @@ -546,7 +546,7 @@ }, cli.BoolFlag{ Name: "strip-vcs, s", - Usage: "Removes version control metada (e.g, .git directory) from the vendor folder.", + Usage: "Removes version control metadata (e.g, .git directory) from the vendor folder.", }, cli.BoolFlag{ Name: "strip-vendor, v", @@ -571,7 +571,7 @@ installer.UpdateVendored = c.Bool("update-vendored") installer.ResolveAllFiles = c.Bool("all-dependencies") installer.Home = c.GlobalString("home") - installer.DeleteUnused = c.Bool("deleteOptIn") + installer.DeleteUnused = c.Bool("delete") action.Update(installer, c.Bool("no-recursive"), c.Bool("strip-vcs"), c.Bool("strip-vendor")) },