diff --git a/cmd/gotype/doc.go b/cmd/gotype/doc.go index ea0b2b1f..12e47413 100644 --- a/cmd/gotype/doc.go +++ b/cmd/gotype/doc.go @@ -27,8 +27,8 @@ The flags are: report all errors (not just the first 10) -v verbose mode - -gccgo - use gccimporter instead of gcimporter + -c + compiler used to compile packages (gc or gccgo); default: gc Debugging flags: -seq diff --git a/cmd/gotype/gotype.go b/cmd/gotype/gotype.go index 4a5c7de4..16a6440e 100644 --- a/cmd/gotype/gotype.go +++ b/cmd/gotype/gotype.go @@ -9,18 +9,16 @@ import ( "fmt" "go/ast" "go/build" + "go/importer" "go/parser" "go/scanner" "go/token" + "go/types" "io/ioutil" "os" "path/filepath" "runtime" "time" - - "golang.org/x/tools/go/gccgoimporter" - _ "golang.org/x/tools/go/gcimporter" - "golang.org/x/tools/go/types" ) var ( @@ -28,7 +26,7 @@ var ( allFiles = flag.Bool("a", false, "use all (incl. _test.go) files when processing a directory") allErrors = flag.Bool("e", false, "report all errors (not just the first 10)") verbose = flag.Bool("v", false, "verbose mode") - gccgo = flag.Bool("gccgo", false, "use gccgoimporter instead of gcimporter") + compiler = flag.String("c", "gc", "compiler used to compile packages (gc or gccgo)") // debugging support sequential = flag.Bool("seq", false, "parse sequentially, rather than in parallel") @@ -195,12 +193,8 @@ func checkPkgFiles(files []*ast.File) { } report(err) }, - Sizes: sizes, - } - if *gccgo { - var inst gccgoimporter.GccgoInstallation - inst.InitFromDriver("gccgo") - conf.Import = inst.GetImporter(nil, nil) + Importer: importer.For(*compiler, nil), + Sizes: sizes, } defer func() {