Permalink
Browse files

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, awaiting a
reply in order to figure out the best plan forward.
  • Loading branch information...
1 parent 6eda189 commit b04c5d45b06baf8301aa4570900f6ce0e1a0c136 @shurcooL shurcooL committed Aug 25, 2015
Showing with 1,002 additions and 2 deletions.
  1. +1 −1 compiler/compiler.go
  2. +1 −1 compiler/package.go
  3. +461 −0 third_party/importer/export.go
  4. +455 −0 third_party/importer/import.go
  5. +84 −0 third_party/importer/predefined.go
@@ -12,7 +12,7 @@ import (
"strings"
"github.com/gopherjs/gopherjs/compiler/prelude"
- "golang.org/x/tools/go/importer"
+ "github.com/gopherjs/gopherjs/third_party/importer"
)
var sizes32 = &types.StdSizes{WordSize: 4, MaxAlign: 8}
View
@@ -11,7 +11,7 @@ import (
"strings"
"github.com/gopherjs/gopherjs/compiler/analysis"
- "golang.org/x/tools/go/importer"
+ "github.com/gopherjs/gopherjs/third_party/importer"
"golang.org/x/tools/go/types/typeutil"
)
Oops, something went wrong.

0 comments on commit b04c5d4

Please sign in to comment.