diff --git a/go/ssa/source_test.go b/go/ssa/source_test.go index 3e294b95768..32959880aba 100644 --- a/go/ssa/source_test.go +++ b/go/ssa/source_test.go @@ -34,7 +34,7 @@ func TestObjValueLookup(t *testing.T) { if err != nil { t.Fatal(err) } - pkgs := packagesFromArchive(t, string(src)) + pkgs := fromTxtar(t, string(src)) prog, _ := ssautil.Packages(pkgs, ssa.BuilderMode(0)) info := getPkgInfo(prog, pkgs, "main") @@ -246,7 +246,7 @@ func testValueForExpr(t *testing.T, testfile string) { t.Fatal(err) } - pkgs := packagesFromArchive(t, string(src)) + pkgs := fromTxtar(t, string(src)) prog, _ := ssautil.Packages(pkgs, ssa.BuilderMode(0)) info := getPkgInfo(prog, pkgs, "main") diff --git a/go/ssa/testutil_test.go b/go/ssa/testutil_test.go index fe85ab613bc..4bf60a7af01 100644 --- a/go/ssa/testutil_test.go +++ b/go/ssa/testutil_test.go @@ -24,7 +24,7 @@ import ( // It's useful to create a ssa package and its packages.Package and ast.File representation. func loadPackageFromSingleFile(t *testing.T, content string, mode ssa.BuilderMode) *pkgInfo { ar := archiveFromSingleFileContent(content) - pkgs := packagesFromArchive(t, ar) + pkgs := fromTxtar(t, ar) prog, _ := ssautil.Packages(pkgs, mode) pkgName := packageName(t, content) @@ -49,9 +49,10 @@ go 1.18 %s`, content) } -// packagesFromArchive creates a temporary folder from the archive and load packages from it. -func packagesFromArchive(t *testing.T, archive string) []*packages.Package { - ar := txtar.Parse([]byte(archive)) +// fromTxtar creates a temporary folder from the content in txtar format +// and then loads the packages. +func fromTxtar(t *testing.T, content string) []*packages.Package { + ar := txtar.Parse([]byte(content)) fs, err := txtar.FS(ar) if err != nil {