Merge branch 'master' of github.com:Masterminds/glide
diff --git a/dependency/resolver.go b/dependency/resolver.go
index 1668f23..8201589 100644
--- a/dependency/resolver.go
+++ b/dependency/resolver.go
@@ -413,7 +413,7 @@
 		// can locate.
 		for _, imp := range pkg.Imports {
 			pi := r.FindPkg(imp)
-			if pi.Loc != LocCgo && pi.Loc != LocGoroot {
+			if pi.Loc != LocCgo && pi.Loc != LocGoroot && pi.Loc != LocAppengine {
 				msg.Debug("Package %s imports %s", dep, imp)
 			}
 			switch pi.Loc {
@@ -713,6 +713,11 @@
 	LocGoroot
 	// LocCgo indicates that the package is a a CGO package
 	LocCgo
+	// LocAppengine indicates the package is part of the appengine SDK. It's a
+	// special build mode. https://blog.golang.org/the-app-engine-sdk-and-workspaces-gopath
+	// Why does a Google product get a special case build mode with a local
+	// package?
+	LocAppengine
 )
 
 // PkgInfo represents metadata about a package found by the resolver.
@@ -793,10 +798,17 @@
 		}
 	}
 
-	// Finally, if this is "C", we're dealing with cgo
+	// If this is "C", we're dealing with cgo
 	if name == "C" {
 		info.Loc = LocCgo
 		r.findCache[name] = info
+	} else if name == "appengine" || strings.HasPrefix(name, "appengine/") {
+		// Appengine is a special case when it comes to Go builds. It is a local
+		// looking package only available within appengine. It's a special case
+		// where Google products are playing with each other.
+		// https://blog.golang.org/the-app-engine-sdk-and-workspaces-gopath
+		info.Loc = LocAppengine
+		r.findCache[name] = info
 	}
 
 	return info
diff --git a/glide.go b/glide.go
index 4a29d06..9fe1e47 100644
--- a/glide.go
+++ b/glide.go
@@ -43,6 +43,7 @@
 	"github.com/Masterminds/glide/msg"
 	gpath "github.com/Masterminds/glide/path"
 	"github.com/Masterminds/glide/repo"
+	"github.com/Masterminds/glide/util"
 
 	"github.com/codegangsta/cli"
 
@@ -202,6 +203,10 @@
 					Name:  "use-gopath",
 					Usage: "Copy dependencies from the GOPATH if they exist there.",
 				},
+				cli.BoolFlag{
+					Name:  "resolve-current",
+					Usage: "Resolve dependencies for only the current system rather than all build modes.",
+				},
 			},
 			Action: func(c *cli.Context) {
 				if len(c.Args()) < 1 {
@@ -209,6 +214,11 @@
 					os.Exit(1)
 				}
 
+				if c.Bool("resolve-current") {
+					util.ResolveCurrent = true
+					msg.Warn("Only resolving dependencies for the current OS/Arch")
+				}
+
 				inst := &repo.Installer{
 					Force:           c.Bool("force"),
 					UseCache:        c.Bool("cache"),
@@ -465,8 +475,18 @@
 					Name:  "use-gopath",
 					Usage: "Copy dependencies from the GOPATH if they exist there.",
 				},
+				cli.BoolFlag{
+					Name:  "resolve-current",
+					Usage: "Resolve dependencies for only the current system rather than all build modes.",
+				},
 			},
 			Action: func(c *cli.Context) {
+
+				if c.Bool("resolve-current") {
+					util.ResolveCurrent = true
+					msg.Warn("Only resolving dependencies for the current OS/Arch")
+				}
+
 				installer := &repo.Installer{
 					DeleteUnused:    c.Bool("deleteOptIn"),
 					UpdateVendored:  c.Bool("update-vendored"),
diff --git a/tree/tree.go b/tree/tree.go
index 0ba0d56..96c7d3e 100644
--- a/tree/tree.go
+++ b/tree/tree.go
@@ -143,9 +143,15 @@
 		}
 	}
 
-	// Finally, if this is "C", we're dealing with cgo
+	// If this is "C", we're dealing with cgo
 	if name == "C" {
 		info.Loc = dependency.LocCgo
+	} else if name == "appengine" || strings.HasPrefix(name, "appengine/") {
+		// Appengine is a special case when it comes to Go builds. It is a local
+		// looking package only available within appengine. It's a special case
+		// where Google products are playing with each other.
+		// https://blog.golang.org/the-app-engine-sdk-and-workspaces-gopath
+		info.Loc = dependency.LocAppengine
 	}
 
 	return info
diff --git a/util/util.go b/util/util.go
index c16c4db..d73001a 100644
--- a/util/util.go
+++ b/util/util.go
@@ -16,6 +16,12 @@
 	"github.com/Masterminds/vcs"
 )
 
+// ResolveCurrent selects whether the package should only the dependencies for
+// the current OS/ARCH instead of all possible permutations.
+// This is not concurrently safe which is ok for the current application. If
+// other needs arise it may need to be re-written.
+var ResolveCurrent = false
+
 func init() {
 	// Precompile the regular expressions used to check VCS locations.
 	for _, v := range vcsList {
@@ -263,9 +269,13 @@
 func GetBuildContext() (*BuildCtxt, error) {
 	buildContext := &BuildCtxt{build.Default}
 
-	// This tells the context scanning to skip filtering on +build flags or
-	// file names.
-	buildContext.UseAllFiles = true
+	// If we aren't resolving for the current system set to look at all
+	// build modes.
+	if !ResolveCurrent {
+		// This tells the context scanning to skip filtering on +build flags or
+		// file names.
+		buildContext.UseAllFiles = true
+	}
 
 	if goRoot := os.Getenv("GOROOT"); len(goRoot) == 0 {
 		out, err := exec.Command("go", "env", "GOROOT").Output()