Revert "go/packages: make tests pass with custom GOCACHE"

This reverts commit e7b5a6dfd88b61ac7c2f61acb9f83cffb4b4f3fa.

Reason for revert: merged by mistake

Change-Id: Ibf6ff4aa346b569aaa5e06b58770a93ca3eebdab
Reviewed-on: https://go-review.googlesource.com/c/156900
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
diff --git a/go/packages/packages_test.go b/go/packages/packages_test.go
index 229abcd..b5d451f 100644
--- a/go/packages/packages_test.go
+++ b/go/packages/packages_test.go
@@ -1389,19 +1389,19 @@
 		ID:   "golang.org/fake/b",
 		Name: "b",
 		Imports: map[string]*packages.Package{
-			"golang.org/fake/a": {ID: "golang.org/fake/a"},
+			"golang.org/fake/a": &packages.Package{ID: "golang.org/fake/a"},
 		},
 	}, {
 		ID:   "golang.org/fake/c",
 		Name: "c",
 		Imports: map[string]*packages.Package{
-			"golang.org/fake/b": {ID: "golang.org/fake/b"},
+			"golang.org/fake/b": &packages.Package{ID: "golang.org/fake/b"},
 		},
 	}, {
 		ID:   "golang.org/fake/d",
 		Name: "d",
 		Imports: map[string]*packages.Package{
-			"golang.org/fake/b": {ID: "golang.org/fake/b"},
+			"golang.org/fake/b": &packages.Package{ID: "golang.org/fake/b"},
 		},
 	}} {
 		got := decoded[i]
@@ -1622,13 +1622,12 @@
 func cleanPaths(paths []string) []string {
 	result := make([]string, len(paths))
 	for i, src := range paths {
-		// If the source file doesn't have an extension like .go or .s,
-		// it comes from GOCACHE. The names there aren't predictable.
-		name := filepath.Base(src)
-		if !strings.Contains(name, ".") {
+		// The default location for cache data is a subdirectory named go-build
+		// in the standard user cache directory for the current operating system.
+		if strings.Contains(filepath.ToSlash(src), "/go-build/") {
 			result[i] = fmt.Sprintf("%d.go", i) // make cache names predictable
 		} else {
-			result[i] = name
+			result[i] = filepath.Base(src)
 		}
 	}
 	return result