From 421f03a57a641a72b8ea4ceb640e73391675fc6f Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Tue, 8 Jan 2019 22:25:39 +0000 Subject: [PATCH] Revert "go/packages: make tests pass with custom GOCACHE" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Daniel Martí --- go/packages/packages_test.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/go/packages/packages_test.go b/go/packages/packages_test.go index 229abcd5..b5d451fd 100644 --- a/go/packages/packages_test.go +++ b/go/packages/packages_test.go @@ -1389,19 +1389,19 @@ func testJSON(t *testing.T, exporter packagestest.Exporter) { 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 srcs(p *packages.Package) []string { 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