forked from golang/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Files named go.mod define a module boundary and punch a hole in the repository when the module is fetched with go get. We had a couple in testdata. Get rid of them. In one case the changes I made to produce a module cache in packagestest were enough. In the other, the test needs multiple minor/patch versions of the same module, which we have no provision for. Rename them to "definitelynot_go.mod" in the repo and fix it up in the test. Updates golang/go#34352 Change-Id: I284578b3aebb0f1fec3ddb4bef0df24f050d0636 Reviewed-on: https://go-review.googlesource.com/c/tools/+/196258 Run-TryBot: Heschi Kreinick <[email protected]> Reviewed-by: Ian Cottrell <[email protected]>
- Loading branch information
Showing
19 changed files
with
23 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1543,41 +1543,37 @@ func testName(t *testing.T, exporter packagestest.Exporter) { | |
|
||
func TestName_Modules(t *testing.T) { | ||
// Test the top-level package case described in runNamedQueries. | ||
// Note that overriding GOPATH below prevents Export from | ||
// creating more than one module. | ||
exported := packagestest.Export(t, packagestest.Modules, []packagestest.Module{{ | ||
Name: "golang.org/pkg", | ||
Files: map[string]interface{}{ | ||
"pkg.go": `package pkg`, | ||
}}}) | ||
exported := packagestest.Export(t, packagestest.Modules, []packagestest.Module{ | ||
{ | ||
Name: "golang.org/pkg", | ||
Files: map[string]interface{}{ | ||
"pkg.go": `package pkg`, | ||
}, | ||
}, | ||
{ | ||
Name: "example.com/tools-testrepo", | ||
Files: map[string]interface{}{ | ||
"pkg/pkg.go": `package pkg`, | ||
}, | ||
}, | ||
{ | ||
Name: "example.com/tools-testrepo/v2", | ||
Files: map[string]interface{}{ | ||
"pkg/pkg.go": `package pkg`, | ||
}, | ||
}, | ||
}) | ||
defer exported.Cleanup() | ||
|
||
wd, err := os.Getwd() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
gopath, err := ioutil.TempDir("", "TestName_Modules") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
defer os.RemoveAll(gopath) | ||
if err := copyAll(filepath.Join(wd, "testdata", "TestName_Modules"), gopath); err != nil { | ||
t.Fatal(err) | ||
} | ||
// testdata/TestNamed_Modules contains: | ||
// - pkg/mod/github.com/heschik/[email protected]/pkg | ||
// - pkg/mod/github.com/heschik/tools-testrepo/[email protected]/pkg | ||
// - src/b/pkg | ||
exported.Config.Mode = packages.LoadImports | ||
exported.Config.Env = append(exported.Config.Env, "GOPATH="+gopath) | ||
initial, err := packages.Load(exported.Config, "iamashamedtousethedisabledqueryname=pkg") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
graph, _ := importGraph(initial) | ||
wantGraph := ` | ||
* github.com/heschik/tools-testrepo/pkg | ||
* github.com/heschik/tools-testrepo/v2/pkg | ||
* example.com/tools-testrepo/pkg | ||
* example.com/tools-testrepo/v2/pkg | ||
* golang.org/pkg | ||
`[1:] | ||
if graph != wantGraph { | ||
|
@@ -2504,7 +2500,7 @@ func copyAll(srcPath, dstPath string) error { | |
if err != nil { | ||
return err | ||
} | ||
dstFilePath := filepath.Join(dstPath, rel) | ||
dstFilePath := strings.Replace(filepath.Join(dstPath, rel), "definitelynot_go.mod", "go.mod", -1) | ||
if err := os.MkdirAll(filepath.Dir(dstFilePath), 0755); err != nil { | ||
return err | ||
} | ||
|
1 change: 0 additions & 1 deletion
1
...estdata/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/list
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
.../TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.info
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...a/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.mod
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-467 Bytes
...a/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.zip
Binary file not shown.
1 change: 0 additions & 1 deletion
1
...stName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/@v/v1.0.0.ziphash
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...data/TestName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/list
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...stName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.0.info
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...estName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.0.mod
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-482 Bytes
...estName_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.0.zip
Binary file not shown.
1 change: 0 additions & 1 deletion
1
...ame_Modules/pkg/mod/cache/download/github.com/heschik/tools-testrepo/v2/@v/v2.0.0.ziphash
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
.../testdata/TestName_Modules/pkg/mod/github.com/heschik/tools-testrepo/[email protected]/pkg/pkg.go
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...ges/testdata/TestName_Modules/pkg/mod/github.com/heschik/[email protected]/pkg/pkg.go
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions
3
...testdata/TestName_ModulesDedup/pkg/mod/github.com/heschik/tools-testrepo/[email protected]/go.mod
This file was deleted.
Oops, something went wrong.
File renamed without changes.
3 changes: 0 additions & 3 deletions
3
...es/testdata/TestName_ModulesDedup/pkg/mod/github.com/heschik/[email protected]/go.mod
This file was deleted.
Oops, something went wrong.