Revert "go/packages: make tests pass with custom GOCACHE"
This reverts commit e7b5a6dfd8
.
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>
This commit is contained in:
parent
e8d59ebc66
commit
421f03a57a
|
@ -1389,19 +1389,19 @@ func testJSON(t *testing.T, exporter packagestest.Exporter) {
|
||||||
ID: "golang.org/fake/b",
|
ID: "golang.org/fake/b",
|
||||||
Name: "b",
|
Name: "b",
|
||||||
Imports: map[string]*packages.Package{
|
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",
|
ID: "golang.org/fake/c",
|
||||||
Name: "c",
|
Name: "c",
|
||||||
Imports: map[string]*packages.Package{
|
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",
|
ID: "golang.org/fake/d",
|
||||||
Name: "d",
|
Name: "d",
|
||||||
Imports: map[string]*packages.Package{
|
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]
|
got := decoded[i]
|
||||||
|
@ -1622,13 +1622,12 @@ func srcs(p *packages.Package) []string {
|
||||||
func cleanPaths(paths []string) []string {
|
func cleanPaths(paths []string) []string {
|
||||||
result := make([]string, len(paths))
|
result := make([]string, len(paths))
|
||||||
for i, src := range paths {
|
for i, src := range paths {
|
||||||
// If the source file doesn't have an extension like .go or .s,
|
// The default location for cache data is a subdirectory named go-build
|
||||||
// it comes from GOCACHE. The names there aren't predictable.
|
// in the standard user cache directory for the current operating system.
|
||||||
name := filepath.Base(src)
|
if strings.Contains(filepath.ToSlash(src), "/go-build/") {
|
||||||
if !strings.Contains(name, ".") {
|
|
||||||
result[i] = fmt.Sprintf("%d.go", i) // make cache names predictable
|
result[i] = fmt.Sprintf("%d.go", i) // make cache names predictable
|
||||||
} else {
|
} else {
|
||||||
result[i] = name
|
result[i] = filepath.Base(src)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue