cmd/gotype: use std lib go/types instead of x/tools version
Change-Id: I89ba20512129d0557f3f606d8242472d78ea37a9 Reviewed-on: https://go-review.googlesource.com/13898 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
6c9aff3429
commit
12c48ced94
|
@ -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
|
||||
|
|
|
@ -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,13 +193,9 @@ func checkPkgFiles(files []*ast.File) {
|
|||
}
|
||||
report(err)
|
||||
},
|
||||
Importer: importer.For(*compiler, nil),
|
||||
Sizes: sizes,
|
||||
}
|
||||
if *gccgo {
|
||||
var inst gccgoimporter.GccgoInstallation
|
||||
inst.InitFromDriver("gccgo")
|
||||
conf.Import = inst.GetImporter(nil, nil)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
switch p := recover().(type) {
|
||||
|
|
Loading…
Reference in New Issue