Skip to content

Commit 76e265b

Browse files
committed
WIP: Vendor x/tools/go/importer, modify it to import go/types.
go/types defines some types just like golang.org/x/tools/go/types, but because they have different import paths, those types are not interchangeable. Not all packages have moved into Go standard library. Namely, golang.org/x/tools/go/importer and golang.org/x/tools/go/types/typeutil are still living in x/tools subrepo. While golang.org/x/tools/go/types/typeutil has been updated to import go/types in https://golang.org/cl/18207, it appears golang.org/x/tools/go/importer has not yet been updated in a similar way. So if we import it as is, we would have incompatible types defined in go/types and golang.org/x/tools/go/types. A temporary solution to have a working codebase is to vendor that package and modify it to import go/types. This can be undone as soon as the upstream package is modified to import go/types itself. I've asked about its status in the aforementioned CL. It seems unusual that golang.org/x/tools/go/types/typeutil was updated but golang.org/x/tools/go/importer was not, I suspect it was an unintended omission.
1 parent 6eda189 commit 76e265b

File tree

5 files changed

+1002
-2
lines changed

5 files changed

+1002
-2
lines changed

compiler/compiler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"strings"
1313

1414
"github.com/gopherjs/gopherjs/compiler/prelude"
15-
"golang.org/x/tools/go/importer"
15+
"github.com/gopherjs/gopherjs/third_party/importer"
1616
)
1717

1818
var sizes32 = &types.StdSizes{WordSize: 4, MaxAlign: 8}

compiler/package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"strings"
1212

1313
"github.com/gopherjs/gopherjs/compiler/analysis"
14-
"golang.org/x/tools/go/importer"
14+
"github.com/gopherjs/gopherjs/third_party/importer"
1515
"golang.org/x/tools/go/types/typeutil"
1616
)
1717

0 commit comments

Comments
 (0)